1 /* 2 * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.openjdk.bench.valhalla.ackermann; 24 25 import org.openjdk.jmh.annotations.BenchmarkMode; 26 import org.openjdk.jmh.annotations.Fork; 27 import org.openjdk.jmh.annotations.Measurement; 28 import org.openjdk.jmh.annotations.Mode; 29 import org.openjdk.jmh.annotations.OutputTimeUnit; 30 import org.openjdk.jmh.annotations.Scope; 31 import org.openjdk.jmh.annotations.State; 32 import org.openjdk.jmh.annotations.Warmup; 33 34 import java.util.concurrent.TimeUnit; 35 36 @Fork(3) 37 @Warmup(iterations = 5, time = 1) 38 @Measurement(iterations = 5, time = 1) 39 @OutputTimeUnit(TimeUnit.NANOSECONDS) 40 @BenchmarkMode(Mode.AverageTime) 41 @State(Scope.Thread) 42 public abstract class AckermannBase { 43 44 // ackermann(1,1748)+ ackermann(2,1897)+ ackermann(3,8); == 9999999 calls 45 // max depth - 3798 46 public static final int X1 = 1; 47 public static final int Y1 = 1748; 48 public static final int X2 = 2; 49 public static final int Y2 = 1897; 50 public static final int X3 = 3; 51 public static final int Y3 = 8; 52 53 public static final int OPI = 9999999; 54 55 }