repo stringlengths 1 191 ⌀ | file stringlengths 23 351 | code stringlengths 0 5.32M | file_length int64 0 5.32M | avg_line_length float64 0 2.9k | max_line_length int64 0 288k | extension_type stringclasses 1 value |
|---|---|---|---|---|---|---|
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/InvocationBlackhole2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class InvocationBlackhole2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(Blackhole bh) {}
}
@Benchmark
public void test(S s, Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,937 | 34.236364 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/InvocationBlackhole3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class InvocationBlackhole3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(Blackhole bh) {}
@TearDown(Level.Invocation)
public void trial(Blackhole bh) {}
}
@Benchmark
public void test(S s, Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,062 | 33.966102 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/IterationBlackhole1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class IterationBlackhole1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(Blackhole bh) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,921 | 33.945455 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/IterationBlackhole2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class IterationBlackhole2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(Blackhole bh) {}
}
@Benchmark
public void test(S s, Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,935 | 34.2 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/IterationBlackhole3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class IterationBlackhole3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(Blackhole bh) {}
@TearDown(Level.Iteration)
public void trial(Blackhole bh) {}
}
@Benchmark
public void test(S s, Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,059 | 33.915254 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/TrialBlackhole1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class TrialBlackhole1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(Blackhole bh) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,913 | 33.8 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/TrialBlackhole2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class TrialBlackhole2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(Blackhole bh) {}
}
@Benchmark
public void test(S s, Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,927 | 34.054545 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/blackholes/TrialBlackhole3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
public class TrialBlackhole3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(Blackhole bh) {}
@TearDown(Level.Trial)
public void trial(Blackhole bh) {}
}
@Benchmark
public void test(S s, Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,047 | 33.711864 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/InvocationIterParams1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class InvocationIterParams1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(IterationParams bp) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,936 | 34.218182 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/InvocationIterParams2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class InvocationIterParams2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(IterationParams bh) {}
}
@Benchmark
public void test(S s, IterationParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,956 | 34.581818 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/InvocationIterParams3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class InvocationIterParams3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(IterationParams bh) {}
@TearDown(Level.Invocation)
public void trial(IterationParams bh) {}
}
@Benchmark
public void test(S s, IterationParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,087 | 34.389831 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/IterationIterParams1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class IterationIterParams1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(IterationParams bh) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,934 | 34.181818 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/IterationIterParams2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class IterationIterParams2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(IterationParams bh) {}
}
@Benchmark
public void test(S s, IterationParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,954 | 34.545455 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/IterationIterParams3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class IterationIterParams3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(IterationParams bh) {}
@TearDown(Level.Iteration)
public void trial(IterationParams bh) {}
}
@Benchmark
public void test(S s, IterationParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,084 | 34.338983 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/TrialIterParams1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class TrialIterParams1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(IterationParams bh) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,926 | 34.036364 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/TrialIterParams2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class TrialIterParams2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(IterationParams bh) {}
}
@Benchmark
public void test(S s, IterationParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,946 | 34.4 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/iterparams/TrialIterParams3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.iterparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.IterationParams;
public class TrialIterParams3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(IterationParams bh) {}
@TearDown(Level.Trial)
public void trial(IterationParams bh) {}
}
@Benchmark
public void test(S s, IterationParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,072 | 34.135593 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/InvocationThreadParams1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class InvocationThreadParams1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(ThreadParams bp) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,934 | 34.181818 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/InvocationThreadParams2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class InvocationThreadParams2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(ThreadParams bh) {}
}
@Benchmark
public void test(S s, ThreadParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,951 | 34.490909 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/InvocationThreadParams3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class InvocationThreadParams3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Invocation)
public void setup(ThreadParams bh) {}
@TearDown(Level.Invocation)
public void trial(ThreadParams bh) {}
}
@Benchmark
public void test(S s, ThreadParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,079 | 34.254237 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/IterationThreadParams1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class IterationThreadParams1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(ThreadParams bh) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,932 | 34.145455 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/IterationThreadParams2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class IterationThreadParams2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(ThreadParams bh) {}
}
@Benchmark
public void test(S s, ThreadParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,949 | 34.454545 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/IterationThreadParams3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class IterationThreadParams3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Iteration)
public void setup(ThreadParams bh) {}
@TearDown(Level.Iteration)
public void trial(ThreadParams bh) {}
}
@Benchmark
public void test(S s, ThreadParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,076 | 34.20339 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/TrialThreadParams1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class TrialThreadParams1Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(ThreadParams bh) {}
}
@Benchmark
public void test(S s) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,924 | 34 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/TrialThreadParams2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class TrialThreadParams2Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(ThreadParams bh) {}
}
@Benchmark
public void test(S s, ThreadParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,941 | 34.309091 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/explicit/threadparams/TrialThreadParams3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.explicit.threadparams;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.ThreadParams;
public class TrialThreadParams3Test {
@State(Scope.Benchmark)
public static class S {
@Setup(Level.Trial)
public void setup(ThreadParams bh) {}
@TearDown(Level.Trial)
public void trial(ThreadParams bh) {}
}
@Benchmark
public void test(S s, ThreadParams bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,064 | 34 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/PackageTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
@State(Scope.Benchmark)
public class PackageTest {
@Setup(Level.Trial)
void setup() {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertFail(this.getClass());
}
}
| 1,788 | 33.403846 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/PrivateTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
@State(Scope.Benchmark)
public class PrivateTest {
@Setup(Level.Trial)
private void setup() {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertFail(this.getClass());
}
}
| 1,796 | 33.557692 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/ProtectedTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
@State(Scope.Benchmark)
public class ProtectedTest {
@Setup(Level.Trial)
protected void setup() {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertFail(this.getClass());
}
}
| 1,800 | 33.634615 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/PublicArgsControlTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Control;
@State(Scope.Benchmark)
public class PublicArgsControlTest {
@Setup(Level.Trial)
public void setup(Control cnt) {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,852 | 33.962264 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/PublicArgsTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import java.util.concurrent.atomic.AtomicInteger;
@State(Scope.Benchmark)
public class PublicArgsTest {
@Setup(Level.Trial)
public void setup(AtomicInteger v) {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertFail(this.getClass());
}
}
| 1,864 | 33.537037 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/PublicFinalTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
@State(Scope.Benchmark)
public class PublicFinalTest {
@Setup(Level.Trial)
public final void setup() {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,803 | 33.692308 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/PublicReturnTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
@State(Scope.Benchmark)
public class PublicReturnTest {
@Setup(Level.Trial)
public int setup() {
return 42;
}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertFail(this.getClass());
}
}
| 1,823 | 32.777778 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/PublicTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
@State(Scope.Benchmark)
public class PublicTest {
@Setup(Level.Trial)
public void setup() {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,792 | 33.480769 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/InvocationBlackhole1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class InvocationBlackhole1Test {
@Setup(Level.Invocation)
public void setup(Blackhole bh) {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,874 | 34.377358 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/InvocationBlackhole2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class InvocationBlackhole2Test {
@Setup(Level.Invocation)
public void setup(Blackhole bh) {}
@Benchmark
public void test(Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,886 | 34.603774 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/InvocationBlackhole3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class InvocationBlackhole3Test {
@Setup(Level.Invocation)
public void setup(Blackhole bh) {}
@TearDown(Level.Invocation)
public void tearDown(Blackhole bh) {}
@Benchmark
public void test(Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,006 | 34.210526 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/IterationBlackhole1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class IterationBlackhole1Test {
@Setup(Level.Iteration)
public void setup(Blackhole bh) {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,872 | 34.339623 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/IterationBlackhole2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class IterationBlackhole2Test {
@Setup(Level.Iteration)
public void setup(Blackhole bh) {}
@Benchmark
public void test(Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,884 | 34.566038 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/IterationBlackhole3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class IterationBlackhole3Test {
@Setup(Level.Iteration)
public void setup(Blackhole bh) {}
@TearDown(Level.Iteration)
public void tearDown(Blackhole bh) {}
@Benchmark
public void test(Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 2,003 | 34.157895 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/TrialBlackhole1Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class TrialBlackhole1Test {
@Setup(Level.Trial)
public void setup(Blackhole bh) {}
@Benchmark
public void test() {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,864 | 34.188679 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/TrialBlackhole2Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class TrialBlackhole2Test {
@Setup(Level.Trial)
public void setup(Blackhole bh) {}
@Benchmark
public void test(Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,876 | 34.415094 | 79 | java |
jmh | jmh-master/jmh-core-ct/src/test/java/org/openjdk/jmh/ct/states/helpers/implicit/blackholes/TrialBlackhole3Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.ct.states.helpers.implicit.blackholes;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.ct.CompileTest;
import org.openjdk.jmh.infra.Blackhole;
@State(Scope.Benchmark)
public class TrialBlackhole3Test {
@Setup(Level.Trial)
public void setup(Blackhole bh) {}
@TearDown(Level.Trial)
public void tearDown(Blackhole bh) {}
@Benchmark
public void test(Blackhole bh) {
}
@Test
public void compileTest() {
CompileTest.assertOK(this.getClass());
}
}
| 1,991 | 33.947368 | 79 | java |
jmh | jmh-master/jmh-core-it/src/main/java/org/openjdk/jmh/it/CustomExecutorService.java | /*
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.*;
/**
* Synthetic executor service to test the corner case where executor always starts
* the task in the separate thread. Tests JMH invariants to the limit.
*/
public class CustomExecutorService implements ExecutorService {
public CustomExecutorService(int maxThreads, String prefix) {
// Do nothing
}
@Override
public void shutdown() {
// Do nothing
}
@Override
public List<Runnable> shutdownNow() {
return new ArrayList<>();
}
@Override
public boolean isShutdown() {
return false;
}
@Override
public boolean isTerminated() {
return false;
}
@Override
public boolean awaitTermination(long timeout, TimeUnit unit) {
return true;
}
@Override
public <T> Future<T> submit(Callable<T> task) {
FutureTask<T> ft = new FutureTask<>(task);
new Thread(ft).start();
return ft;
}
@Override
public void execute(Runnable command) {
new Thread(command).start();
}
@Override
public <T> Future<T> submit(Runnable task, T result) {
throw new UnsupportedOperationException();
}
@Override
public Future<?> submit(Runnable task) {
throw new UnsupportedOperationException();
}
@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) {
throw new UnsupportedOperationException();
}
@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) {
throw new UnsupportedOperationException();
}
@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) {
throw new UnsupportedOperationException();
}
@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) {
throw new UnsupportedOperationException();
}
}
| 3,279 | 29.091743 | 112 | java |
jmh | jmh-master/jmh-core-it/src/main/java/org/openjdk/jmh/it/annsteal/CustomAnnotation.java | /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.annsteal;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CustomAnnotation {
}
| 1,514 | 41.083333 | 79 | java |
jmh | jmh-master/jmh-core-it/src/main/java/org/openjdk/jmh/it/annsteal/CustomBenchmarkProcessor.java | /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.annsteal;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
import java.io.IOException;
import java.io.Writer;
import java.util.Set;
@SupportedAnnotationTypes("*")
public class CustomBenchmarkProcessor extends AbstractProcessor {
public static final String CBP_LIST = "tmp/CBP.list";
@Override
public SourceVersion getSupportedSourceVersion() {
// We may claim to support the latest version, since we are not using
// any version-specific extensions.
return SourceVersion.latest();
}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (TypeElement te : annotations) {
if (te.getQualifiedName().toString().equals(CustomAnnotation.class.getCanonicalName())) {
try {
FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", CBP_LIST);
Writer writer = file.openWriter();
Set<? extends Element> els = roundEnv.getElementsAnnotatedWith(te);
for (Element el : els) {
writer.append(el.getSimpleName());
}
writer.close();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}
return false;
}
}
| 2,959 | 40.111111 | 123 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/Fixtures.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.TimeUnit;
public class Fixtures {
private static final int REPS;
private static final String PROFILE;
static {
REPS = AccessController.doPrivileged(new PrivilegedAction<Integer>() {
public Integer run() {
return Integer.getInteger("jmh.it.reps", 1);
}
});
PROFILE = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty("jmh.core.it.profile");
}
});
}
public static int repetitionCount() {
return REPS;
}
public static String getTestMask(Class<?> klass) {
return klass.getCanonicalName();
}
public static void work() {
// courtesy for parallel-running tests
try {
TimeUnit.MILLISECONDS.sleep(10);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
}
public static boolean expectStableThreads() {
return isDefaultProfile();
}
public static boolean isDefaultProfile() {
return PROFILE.equals("default");
}
public static boolean isVirtualExecutor() {
return PROFILE.contains("executor-virtual");
}
}
| 2,605 | 32.410256 | 80 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/IterationCountAnnTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness favors the iteration count annotations.
*/
@State(Scope.Thread)
public class IterationCountAnnTest {
private final AtomicInteger count = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
count.incrementAndGet();
}
@TearDown
public void tearDown() {
Assert.assertEquals("Single iteration expected", 1, count.get());
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
public void test() {
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.build();
new Runner(opts).run();
}
}
| 2,953 | 33.752941 | 79 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/IterationCountCmdTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness favors the iteration count cmdline parameters.
*/
@State(Scope.Thread)
public class IterationCountCmdTest {
private final AtomicInteger count = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
count.incrementAndGet();
}
@TearDown
public void tearDown() {
Assert.assertEquals("Single iteration expected", 1, count.get());
}
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(1)
public void test() {
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(100))
.warmupIterations(0)
.build();
new Runner(opt).run();
}
}
| 2,914 | 33.702381 | 79 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/SingleShotTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness had indeed executed different tests in different JVMs.
*/
@BenchmarkMode(Mode.SingleShotTime)
public class SingleShotTest {
private static final AtomicInteger test1executed = new AtomicInteger();
private static final AtomicInteger test2executed = new AtomicInteger();
@Benchmark
@Fork(1)
public void test1() {
Fixtures.work();
Assert.assertEquals(1, test1executed.incrementAndGet());
Assert.assertEquals(0, test2executed.get());
}
@Benchmark
@Fork(1)
public void test2() {
Fixtures.work();
Assert.assertEquals(1, test2executed.incrementAndGet());
Assert.assertEquals(0, test1executed.get());
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.forks(1)
.build();
new Runner(opt).run();
}
@Test
public void invokeAPI_1() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.forks(2)
.build();
new Runner(opt).run();
}
}
| 3,023 | 34.162791 | 79 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/StackTraceInThrowableTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
@State(Scope.Thread)
public class StackTraceInThrowableTest {
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
public void test() {
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.jvmArgs("-XX:-StackTraceInThrowable")
.build();
new Runner(opts).run();
}
}
| 2,461 | 35.746269 | 79 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/WarmupIterationCountAnnTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors warmup annotation settings.
*/
@State(Scope.Thread)
public class WarmupIterationCountAnnTest {
private final AtomicInteger count = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
count.incrementAndGet();
}
@TearDown
public void tearDown() {
Assert.assertEquals("Four iterations expected", 4, count.get());
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 3, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
public void test() {
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.build();
new Runner(opt).run();
}
}
| 2,999 | 34.294118 | 79 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/WarmupIterationCountCmdTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors warmup command line settings.
*/
@State(Scope.Thread)
public class WarmupIterationCountCmdTest {
private final AtomicInteger count = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
count.incrementAndGet();
}
@TearDown
public void tearDown() {
Assert.assertEquals("Four iterations expected", 4, count.get());
}
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(1)
public void test() {
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupTime(TimeValue.milliseconds(100))
.measurementTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.warmupIterations(3)
.build();
new Runner(opt).run();
}
}
| 2,967 | 33.511628 | 79 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/annsteal/CustomTest.java | /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.annsteal;
import org.junit.Test;
import org.junit.Assert;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.util.FileUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
@CustomAnnotation // here!
public class CustomTest {
@Benchmark
public void bench() {
// intentionally left blank
}
@Test
public void test() throws IOException {
if (!"default".equals(System.getProperty("jmh.core.it.profile"))) {
return;
}
InputStream list = CustomTest.class.getResourceAsStream('/' + CustomBenchmarkProcessor.CBP_LIST);
if (list == null) {
throw new IllegalStateException(CustomBenchmarkProcessor.class.getSimpleName() + " list is not found");
}
Collection<String> strings = FileUtils.readAllLines(list);
Assert.assertTrue(strings.contains(CustomTest.class.getSimpleName()));
}
}
| 2,186 | 35.45 | 115 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/asymm/ExactThreadCountTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.asymm;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Group;
import org.openjdk.jmh.annotations.GroupThreads;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
@Fork(1)
public class ExactThreadCountTest {
private final Set<Thread> test1threads = Collections.synchronizedSet(new HashSet<>());
private final Set<Thread> test2threads = Collections.synchronizedSet(new HashSet<>());
@Setup(Level.Iteration)
public void setup() {
test1threads.clear();
test2threads.clear();
}
@TearDown(Level.Iteration)
public void check() {
Assert.assertEquals(1, test1threads.size());
Assert.assertEquals(2, test2threads.size());
}
@Benchmark
@Group("test")
@GroupThreads(1)
public void test1() {
test1threads.add(Thread.currentThread());
Fixtures.work();
}
@Benchmark
@Group("test")
@GroupThreads(2)
public void test2() {
test2threads.add(Thread.currentThread());
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass())+".*test")
.shouldFailOnError(true)
.build();
new Runner(opt).run();
}
}
}
| 3,582 | 33.786408 | 90 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/asymm/Zero1ThreadCountTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.asymm;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
@Fork(1)
public class Zero1ThreadCountTest {
private final Set<Thread> test1threads = Collections.synchronizedSet(new HashSet<>());
private final Set<Thread> test2threads = Collections.synchronizedSet(new HashSet<>());
@TearDown
public void check() {
Assert.assertEquals(0, test1threads.size());
if (Fixtures.expectStableThreads()) {
Assert.assertEquals(2, test2threads.size());
} else {
Assert.assertTrue(test2threads.size() >= 2);
}
}
@Benchmark
@Group("test")
@GroupThreads(0)
public void test1() {
test1threads.add(Thread.currentThread());
Fixtures.work();
}
@Benchmark
@Group("test")
@GroupThreads(2)
public void test2() {
test2threads.add(Thread.currentThread());
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()) + ".*test")
.shouldFailOnError(true)
.build();
new Runner(opt).run();
}
}
}
| 3,045 | 33.224719 | 90 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/asymm/Zero2ThreadCountTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.asymm;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Group;
import org.openjdk.jmh.annotations.GroupThreads;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
@Fork(1)
public class Zero2ThreadCountTest {
private final Set<Thread> test1threads = Collections.synchronizedSet(new HashSet<>());
private final Set<Thread> test2threads = Collections.synchronizedSet(new HashSet<>());
@TearDown
public void check() {
if (Fixtures.expectStableThreads()) {
Assert.assertEquals(1, test1threads.size());
} else {
Assert.assertTrue(test1threads.size() >= 1);
}
Assert.assertEquals(0, test2threads.size());
}
@Benchmark
@Group("test")
@GroupThreads(1)
public void test1() {
test1threads.add(Thread.currentThread());
Fixtures.work();
}
@Benchmark
@Group("test")
@GroupThreads(0)
public void test2() {
test2threads.add(Thread.currentThread());
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()) + ".*test")
.shouldFailOnError(true)
.build();
new Runner(opt).run();
}
}
}
| 3,496 | 34.323232 | 90 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/auxcounters/AuxCountersEventsTest.java | /*
* Copyright (c) 2016, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.auxcounters;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
@Warmup(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
public class AuxCountersEventsTest {
@AuxCounters(AuxCounters.Type.EVENTS)
@State(Scope.Thread)
public static class Counters {
public int cnt;
}
@Benchmark
public void test(Counters cnt) {
if (cnt.cnt == 0) {
// set event once
cnt.cnt = 42;
}
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.build();
RunResult result = new Runner(opts).runSingle();
Result prim = result.getPrimaryResult();
Result scnd = result.getSecondaryResults().get("cnt");
switch (mode) {
case Throughput:
case AverageTime:
case SampleTime:
case SingleShotTime: {
Assert.assertNotNull("@AuxCounter result exists for " + mode, scnd);
Assert.assertEquals("#", scnd.getScoreUnit());
// Sample time is special, because it is allowed to lose the samples.
if (mode != Mode.SampleTime) {
Assert.assertEquals(prim.getSampleCount(), scnd.getSampleCount());
}
// 5 iterations, each returns exactly 42 events
Assert.assertEquals(5 * 42, scnd.getScore(), 0.001);
Assert.assertEquals(Double.NaN, scnd.getScoreError(), 0.001);
break;
}
default: {
Assert.assertNull("@AuxCounter does not exist for " + mode, scnd);
}
}
}
}
}
| 3,732 | 35.598039 | 90 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/auxcounters/AuxCountersOperationsTest.java | /*
* Copyright (c) 2016, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.auxcounters;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
@Warmup(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
public class AuxCountersOperationsTest {
@AuxCounters(AuxCounters.Type.OPERATIONS)
@State(Scope.Thread)
public static class Counters {
public int cnt;
}
@Benchmark
public void test(Counters cnt) {
cnt.cnt++;
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.build();
RunResult result = new Runner(opts).runSingle();
Result prim = result.getPrimaryResult();
Result scnd = result.getSecondaryResults().get("cnt");
switch (mode) {
case Throughput:
case AverageTime: {
Assert.assertNotNull("@AuxCounter result exists for " + mode, scnd);
// Should match primary metric exactly.
Assert.assertEquals(prim.getSampleCount(), scnd.getSampleCount());
Assert.assertEquals(prim.getScoreUnit(), scnd.getScoreUnit());
Assert.assertEquals(prim.getScore(), scnd.getScore(), 0.001);
Assert.assertEquals(prim.getScoreError(), scnd.getScoreError(), 0.001);
break;
}
default: {
Assert.assertNull("@AuxCounter does not exist for " + mode, scnd);
}
}
}
}
}
| 3,454 | 36.150538 | 91 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/BatchSizeSanityTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@State(Scope.Benchmark)
public class BatchSizeSanityTest {
private static final int SLEEP_TIME_MS = 50;
@AuxCounters(AuxCounters.Type.EVENTS)
@State(Scope.Thread)
public static class TimeCounter {
public long time;
}
@AuxCounters(AuxCounters.Type.EVENTS)
@State(Scope.Thread)
public static class OpsCounter {
public int ops;
}
private long startTime;
@Setup(Level.Iteration)
public void setup() {
startTime = System.nanoTime();
}
@TearDown(Level.Iteration)
public void tearDown(TimeCounter cnt) {
cnt.time = System.nanoTime() - startTime;
}
@Benchmark
public void test(OpsCounter cnt) throws InterruptedException {
TimeUnit.MILLISECONDS.sleep(SLEEP_TIME_MS);
cnt.ops++;
}
@Test
public void invokeAPI() throws RunnerException {
for (int bs : new int[] {1, 10, 100}) {
for (Mode m : Mode.values()) {
if (m == Mode.All) continue;
doWith(m, bs);
}
}
}
private void doWith(Mode mode, int batchSize) throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(0)
.measurementTime(TimeValue.seconds(1))
.measurementIterations(5)
.forks(1)
.timeUnit(TimeUnit.MILLISECONDS)
.syncIterations(false)
.measurementBatchSize(batchSize)
.mode(mode)
.build();
RunResult run = new Runner(opt).runSingle();
final double TOLERANCE = 0.30;
Map<String, Result> srs = run.getSecondaryResults();
Assert.assertNotNull("Ops counter is available for " + mode, srs.get("ops"));
Assert.assertNotNull("Time counter is available for " + mode, srs.get("time"));
double realOps = srs.get("ops").getScore();
double realTime = srs.get("time").getScore() / 1_000_000;
double actualScore = run.getPrimaryResult().getStatistics().getMean();
double expectedScore;
switch (mode) {
case Throughput:
expectedScore = 1.0 * (1.0 * realOps / batchSize) / realTime;
break;
case AverageTime:
case SampleTime:
case SingleShotTime:
expectedScore = 1.0 * realTime / (1.0 * realOps / batchSize);
break;
default:
expectedScore = Double.NaN;
actualScore = Double.NaN;
Assert.fail("Unhandled mode: " + mode);
}
Assert.assertTrue(
String.format("mode = %s, batch size = %d, expected score = %e, actual score = %e; real time = %.5f, real ops = %.5f",
mode, batchSize, expectedScore, actualScore,
realTime, realOps),
Math.abs(1 - actualScore / expectedScore) < TOLERANCE);
}
}
| 4,798 | 33.775362 | 134 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/OpsPerInvSanityTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@State(Scope.Thread)
public class OpsPerInvSanityTest {
private static final int SLEEP_TIME_MS = 50;
@AuxCounters(AuxCounters.Type.EVENTS)
@State(Scope.Thread)
public static class TimeCounter {
public long time;
}
@AuxCounters(AuxCounters.Type.EVENTS)
@State(Scope.Thread)
public static class OpsCounter {
public int ops;
}
private long startTime;
@Setup(Level.Iteration)
public void setup() {
startTime = System.nanoTime();
}
@TearDown(Level.Iteration)
public void tearDown(TimeCounter cnt) {
cnt.time = System.nanoTime() - startTime;
}
@Benchmark
public void test(OpsCounter cnt) throws InterruptedException {
TimeUnit.MILLISECONDS.sleep(SLEEP_TIME_MS);
cnt.ops++;
}
@Test
public void invokeAPI() throws RunnerException {
for (int opsPerInv : new int[] {1, 10, 100}) {
for (Mode m : Mode.values()) {
if (m == Mode.All) continue;
doWith(m, opsPerInv);
}
}
}
private void doWith(Mode mode, int opsPerInv) throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(0)
.measurementTime(TimeValue.seconds(1))
.measurementIterations(5)
.forks(1)
.timeUnit(TimeUnit.MILLISECONDS)
.syncIterations(false)
.operationsPerInvocation(opsPerInv)
.mode(mode)
.build();
RunResult run = new Runner(opt).runSingle();
final double TOLERANCE = 0.30;
Map<String, Result> srs = run.getSecondaryResults();
Assert.assertNotNull("Ops counter is available for " + mode, srs.get("ops"));
Assert.assertNotNull("Time counter is available for " + mode, srs.get("time"));
double realOps = srs.get("ops").getScore();
double realTime = srs.get("time").getScore() / 1_000_000;
double actualScore = run.getPrimaryResult().getStatistics().getMean();
double expectedScore;
switch (mode) {
case Throughput:
expectedScore = 1.0 * (realOps * opsPerInv) / realTime;
break;
case AverageTime:
case SampleTime:
case SingleShotTime:
expectedScore = 1.0 * realTime / (realOps * opsPerInv);
break;
default:
expectedScore = Double.NaN;
actualScore = Double.NaN;
Assert.fail("Unhandled mode: " + mode);
}
Assert.assertTrue(
String.format("mode = %s, ops per inv = %d, expected score = %e, actual score = %e; real time = %.5f, real ops = %.5f",
mode, opsPerInv, expectedScore, actualScore,
realTime, realOps),
Math.abs(1 - actualScore / expectedScore) < TOLERANCE);
}
}
| 4,789 | 33.710145 | 135 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/SingleShotBatchAnn05Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors batch size annotation settings.
*/
@State(Scope.Thread)
public class SingleShotBatchAnn05Test {
private static final int WARMUP_ITERATIONS = 2;
private static final int MEASUREMENT_ITERATIONS = 1;
private static final int WARMUP_BATCH = 0;
private static final int MEASUREMENT_BATCH = 5;
private final AtomicInteger iterationCount = new AtomicInteger();
private final AtomicInteger batchCount = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
iterationCount.incrementAndGet();
batchCount.set(0);
}
private boolean isWarmup() {
return iterationCount.get() <= WARMUP_ITERATIONS;
}
@TearDown(Level.Iteration)
public void tearDownIter() {
if(isWarmup()) {
Assert.assertEquals(WARMUP_BATCH + " batch size expected", WARMUP_BATCH, batchCount.get());
} else {
Assert.assertEquals(MEASUREMENT_BATCH + " batch size expected", MEASUREMENT_BATCH, batchCount.get());
}
}
@TearDown
public void tearDownTrial() {
Assert.assertEquals((MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS)+" iterations expected", (MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS), iterationCount.get());
}
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, batchSize = WARMUP_BATCH)
@Measurement(iterations = MEASUREMENT_ITERATIONS, batchSize = MEASUREMENT_BATCH)
@BenchmarkMode(Mode.SingleShotTime)
@Fork(1)
public void test() {
Fixtures.work();
batchCount.incrementAndGet();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.build();
new Runner(opt).run();
}
}
}
| 4,005 | 36.092593 | 161 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/SingleShotBatchAnn15Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors batch size annotation settings.
*/
@State(Scope.Thread)
public class SingleShotBatchAnn15Test {
private static final int WARMUP_ITERATIONS = 2;
private static final int MEASUREMENT_ITERATIONS = 1;
private static final int WARMUP_BATCH = 1;
private static final int MEASUREMENT_BATCH = 5;
private final AtomicInteger iterationCount = new AtomicInteger();
private final AtomicInteger batchCount = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
iterationCount.incrementAndGet();
batchCount.set(0);
}
private boolean isWarmup() {
return iterationCount.get() <= WARMUP_ITERATIONS;
}
@TearDown(Level.Iteration)
public void tearDownIter() {
if(isWarmup()) {
Assert.assertEquals(WARMUP_BATCH + " batch size expected", WARMUP_BATCH, batchCount.get());
} else {
Assert.assertEquals(MEASUREMENT_BATCH + " batch size expected", MEASUREMENT_BATCH, batchCount.get());
}
}
@TearDown
public void tearDownTrial() {
Assert.assertEquals((MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS)+" iterations expected", (MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS), iterationCount.get());
}
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, batchSize = WARMUP_BATCH)
@Measurement(iterations = MEASUREMENT_ITERATIONS, batchSize = MEASUREMENT_BATCH)
@BenchmarkMode(Mode.SingleShotTime)
@Fork(1)
public void test() {
Fixtures.work();
batchCount.incrementAndGet();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.build();
new Runner(opt).run();
}
}
| 3,912 | 35.915094 | 161 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/SingleShotBatchAnn56Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors batch size annotation settings.
*/
@State(Scope.Thread)
public class SingleShotBatchAnn56Test {
private static final int WARMUP_ITERATIONS = 2;
private static final int MEASUREMENT_ITERATIONS = 1;
private static final int WARMUP_BATCH = 1;
private static final int MEASUREMENT_BATCH = 5;
private final AtomicInteger iterationCount = new AtomicInteger();
private final AtomicInteger batchCount = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
iterationCount.incrementAndGet();
batchCount.set(0);
}
private boolean isWarmup() {
return iterationCount.get() <= WARMUP_ITERATIONS;
}
@TearDown(Level.Iteration)
public void tearDownIter() {
if(isWarmup()) {
Assert.assertEquals(WARMUP_BATCH + " batch size expected", WARMUP_BATCH, batchCount.get());
} else {
Assert.assertEquals(MEASUREMENT_BATCH + " batch size expected", MEASUREMENT_BATCH, batchCount.get());
}
}
@TearDown
public void tearDownTrial() {
Assert.assertEquals((MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS)+" iterations expected", (MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS), iterationCount.get());
}
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, batchSize = WARMUP_BATCH)
@Measurement(iterations = MEASUREMENT_ITERATIONS, batchSize = MEASUREMENT_BATCH)
@BenchmarkMode(Mode.SingleShotTime)
@Fork(1)
public void test() {
Fixtures.work();
batchCount.incrementAndGet();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.build();
new Runner(opt).run();
}
}
| 3,912 | 35.915094 | 161 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/SingleShotBatchApi05Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors batch size annotation settings.
*/
@State(Scope.Thread)
public class SingleShotBatchApi05Test {
private static final int WARMUP_ITERATIONS = 2;
private static final int MEASUREMENT_ITERATIONS = 1;
private static final int WARMUP_BATCH = 1;
private static final int MEASUREMENT_BATCH = 5;
private final AtomicInteger iterationCount = new AtomicInteger();
private final AtomicInteger batchCount = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
iterationCount.incrementAndGet();
batchCount.set(0);
}
private boolean isWarmup() {
return iterationCount.get() <= WARMUP_ITERATIONS;
}
@TearDown(Level.Iteration)
public void tearDownIter() {
if(isWarmup()) {
Assert.assertEquals(WARMUP_BATCH + " batch size expected", WARMUP_BATCH, batchCount.get());
} else {
Assert.assertEquals(MEASUREMENT_BATCH + " batch size expected", MEASUREMENT_BATCH, batchCount.get());
}
}
@TearDown
public void tearDownTrial() {
Assert.assertEquals((MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS)+" iterations expected", (MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS), iterationCount.get());
}
@Benchmark
@Fork(1)
public void test() {
Fixtures.work();
batchCount.incrementAndGet();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(WARMUP_ITERATIONS)
.warmupBatchSize(WARMUP_BATCH)
.measurementIterations(MEASUREMENT_ITERATIONS)
.measurementBatchSize(MEASUREMENT_BATCH)
.mode(Mode.SingleShotTime)
.build();
new Runner(opt).run();
}
}
| 3,536 | 35.091837 | 161 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/SingleShotBatchApi15Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors batch size annotation settings.
*/
@State(Scope.Thread)
public class SingleShotBatchApi15Test {
private static final int WARMUP_ITERATIONS = 2;
private static final int MEASUREMENT_ITERATIONS = 1;
private static final int WARMUP_BATCH = 1;
private static final int MEASUREMENT_BATCH = 5;
private final AtomicInteger iterationCount = new AtomicInteger();
private final AtomicInteger batchCount = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
iterationCount.incrementAndGet();
batchCount.set(0);
}
private boolean isWarmup() {
return iterationCount.get() <= WARMUP_ITERATIONS;
}
@TearDown(Level.Iteration)
public void tearDownIter() {
if(isWarmup()) {
Assert.assertEquals(WARMUP_BATCH + " batch size expected", WARMUP_BATCH, batchCount.get());
} else {
Assert.assertEquals(MEASUREMENT_BATCH + " batch size expected", MEASUREMENT_BATCH, batchCount.get());
}
}
@TearDown
public void tearDownTrial() {
Assert.assertEquals((MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS)+" iterations expected", (MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS), iterationCount.get());
}
@Benchmark
@Fork(1)
public void test() {
Fixtures.work();
batchCount.incrementAndGet();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(WARMUP_ITERATIONS)
.warmupBatchSize(WARMUP_BATCH)
.measurementIterations(MEASUREMENT_ITERATIONS)
.measurementBatchSize(MEASUREMENT_BATCH)
.mode(Mode.SingleShotTime)
.build();
new Runner(opt).run();
}
}
| 3,839 | 35.571429 | 161 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/batchsize/SingleShotBatchApi67Test.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.batchsize;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests if harness honors batch size annotation settings.
*/
@State(Scope.Thread)
public class SingleShotBatchApi67Test {
private static final int WARMUP_ITERATIONS = 2;
private static final int MEASUREMENT_ITERATIONS = 1;
private static final int WARMUP_BATCH = 6;
private static final int MEASUREMENT_BATCH = 7;
private final AtomicInteger iterationCount = new AtomicInteger();
private final AtomicInteger batchCount = new AtomicInteger();
@Setup(Level.Iteration)
public void setup() {
iterationCount.incrementAndGet();
batchCount.set(0);
}
private boolean isWarmup() {
return iterationCount.get() <= WARMUP_ITERATIONS;
}
@TearDown(Level.Iteration)
public void tearDownIter() {
if(isWarmup()) {
Assert.assertEquals(WARMUP_BATCH + " batch size expected", WARMUP_BATCH, batchCount.get());
} else {
Assert.assertEquals(MEASUREMENT_BATCH + " batch size expected", MEASUREMENT_BATCH, batchCount.get());
}
}
@TearDown
public void tearDownTrial() {
Assert.assertEquals((MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS)+" iterations expected", (MEASUREMENT_ITERATIONS+WARMUP_ITERATIONS), iterationCount.get());
}
@Benchmark
@Fork(1)
public void test() {
Fixtures.work();
batchCount.incrementAndGet();
}
@Test
public void invokeAPI() throws RunnerException {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(WARMUP_ITERATIONS)
.warmupBatchSize(WARMUP_BATCH)
.measurementIterations(MEASUREMENT_ITERATIONS)
.measurementBatchSize(MEASUREMENT_BATCH)
.mode(Mode.SingleShotTime)
.build();
new Runner(opt).run();
}
}
| 3,839 | 35.571429 | 161 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/NonForkedModesTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import org.openjdk.jmh.runner.options.WarmupMode;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
@State(Scope.Thread)
public class NonForkedModesTest {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeINDI() throws RunnerException {
testWith(WarmupMode.INDI, "WIwi");
}
@Test
public void invokeBULK() throws RunnerException {
testWith(WarmupMode.BULK, "WwIi");
}
@Test
public void invokeBULK_INDI() throws RunnerException {
testWith(WarmupMode.BULK_INDI, "WwWIwi");
}
public void testWith(WarmupMode mode, String runSeq) throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(1)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(1)
.forks(0)
.syncIterations(false)
.warmupMode(mode)
.build();
new Runner(opt).run();
assertEquals(runSeq, getSequence());
}
}
| 4,542 | 31.45 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode0_Test.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
/**
* Tests if harness honors warmup command line settings like:
* -wmb
* -wm
* -frw
* ....
*/
@State(Scope.Thread)
public class WarmupMode0_Test {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeAPI() throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()) + ".testBig.*")
.shouldFailOnError(true)
.warmupIterations(2)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(1)
.forks(0)
.syncIterations(false)
.build();
new Runner(opt).run();
assertEquals("WWI", getSequence());
}
}
| 4,198 | 31.053435 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode1_Test.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
/**
* Tests if harness honors warmup command line settings like:
* -wmb
* -wm
* -frw
* ....
*/
@State(Scope.Thread)
public class WarmupMode1_Test {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeAPI() throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()) + ".testSmall.*")
.shouldFailOnError(true)
.warmupIterations(2)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(1)
.forks(0)
.syncIterations(false)
.build();
new Runner(opt).run();
assertEquals("wwi", getSequence());
}
}
| 4,200 | 31.068702 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode2_Test.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
/**
* Tests if harness honors warmup command line settings like:
* -wmb
* -wm
* -frw
* ....
*/
@State(Scope.Thread)
public class WarmupMode2_Test {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeAPI() throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()) + ".testBig.*")
.shouldFailOnError(true)
.warmupIterations(2)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(2)
.forks(0)
.syncIterations(false)
.build();
new Runner(opt).run();
assertEquals("WWWWII", getSequence());
}
}
| 4,201 | 31.076336 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode3_Test.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
/**
* Tests if harness honors warmup command line settings like:
* -wmb
* -wm
* -frw
* ....
*/
@State(Scope.Thread)
public class WarmupMode3_Test {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeAPI() throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(2)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(2)
.forks(0)
.syncIterations(false)
.build();
new Runner(opt).run();
assertEquals("WWWWIIwwwwii", getSequence());
}
}
| 4,191 | 31.246154 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode4_Test.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
/**
* Tests if harness honors warmup command line settings like:
* -wmb
* -wm
* -frw
* ....
*/
@State(Scope.Thread)
public class WarmupMode4_Test {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeAPI() throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(2)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(1)
.forks(0)
.syncIterations(false)
.build();
new Runner(opt).run();
assertEquals("WWIwwi", getSequence());
}
}
| 4,186 | 30.961832 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode5_Test.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import org.openjdk.jmh.runner.options.WarmupMode;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
/**
* Tests if harness honors warmup command line settings like:
* -wmb
* -wm
* -frw
* ....
*/
@State(Scope.Thread)
public class WarmupMode5_Test {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeAPI() throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(2)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(1)
.forks(0)
.syncIterations(false)
.warmupMode(WarmupMode.INDI)
.build();
new Runner(opt).run();
assertEquals("WWIwwi", getSequence());
}
}
| 4,281 | 31.195489 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode6_Test.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.bulkwarmup;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import org.openjdk.jmh.runner.options.WarmupMode;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
/**
* Tests if harness honors warmup command line settings like:
* -wmb
* -wm
* -frw
* ....
*/
@State(Scope.Thread)
public class WarmupMode6_Test {
private static final Queue<String> testSequence = new ConcurrentLinkedQueue<>();
boolean recorded;
@Setup(Level.Iteration)
public void oneShot() {
recorded = false;
}
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
private static String getSequence() {
StringBuilder sb = new StringBuilder();
for (String s : testSequence) {
sb.append(s);
}
return sb.toString();
}
@Test
public void invokeAPI() throws RunnerException {
testSequence.clear();
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.warmupIterations(2)
.warmupTime(TimeValue.milliseconds(100))
.measurementIterations(1)
.measurementTime(TimeValue.milliseconds(200))
.threads(1)
.forks(0)
.syncIterations(false)
.warmupMode(WarmupMode.BULK)
.build();
new Runner(opt).run();
assertEquals("WWwwIi", getSequence());
}
}
| 4,281 | 31.195489 | 84 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlDontInlineActualTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Collection;
public class CompilerControlDontInlineActualTest {
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void strawMethod() {
}
public void trampoline() {
strawMethod();
}
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void compilerControlSpecimen() {
trampoline();
}
@Test
public void testBenchmark() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.addProfiler(LogConsumeProfiler.class)
.measurementIterations(mode == Mode.SingleShotTime ? 200_000 : 1)
.measurementTime(TimeValue.seconds(5))
.warmupIterations(0)
.forks(1)
.jvmArgsPrepend("-XX:CICompilerCount=2") // need to serialize the output properly
.build();
RunResult runResult = new Runner(opts).runSingle();
Collection<String> log = CompilerControlUtils.getLog(runResult);
if (CompilerControlUtils.check(log, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "disallowed by"));
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "disallowed by"));
}
}
}
}
| 3,542 | 37.934066 | 131 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlDontInlineClassTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.runner.RunnerException;
@CompilerControl(Mode.DONT_INLINE)
public class CompilerControlDontInlineClassTest {
@Benchmark
public void compilerControlSpecimen() {}
@Test
public void test() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Class hint should exist",
CompilerControlUtils.hasHint(Mode.DONT_INLINE.command(), className)
);
Assert.assertFalse("Method hint should not exist",
CompilerControlUtils.hasHint("", className, "compilerControlSpecimen")
);
}
}
| 2,095 | 37.814815 | 86 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlDontInlineTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.RunnerException;
public class CompilerControlDontInlineTest {
@CompilerControl(Mode.DONT_INLINE)
void sampleMethod() {}
@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public void dummyTest() {
Fixtures.work();
}
@Test
public void testBenchmark() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on benchmark method",
CompilerControlUtils.hasHint(Mode.DONT_INLINE.command(), className, "dummyTest"));
}
@Test
public void testStandalone() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on standalone method",
CompilerControlUtils.hasHint(Mode.DONT_INLINE.command(), className, "sampleMethod"));
}
}
| 2,380 | 38.032787 | 101 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlExcludeActualTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Collection;
public class CompilerControlExcludeActualTest {
@CompilerControl(CompilerControl.Mode.EXCLUDE)
public void strawMethod() {
}
public void trampoline() {
strawMethod();
}
@Benchmark
@CompilerControl(CompilerControl.Mode.EXCLUDE)
public void compilerControlSpecimen() {
trampoline();
}
@Test
public void testBenchmark() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.addProfiler(LogConsumeProfiler.class)
.measurementIterations(mode == Mode.SingleShotTime ? 200_000 : 1)
.measurementTime(TimeValue.seconds(5))
.warmupIterations(0)
.forks(1)
.jvmArgsPrepend("-XX:CICompilerCount=2") // need to serialize the output properly
.build();
RunResult runResult = new Runner(opts).runSingle();
Collection<String> log = CompilerControlUtils.getLog(runResult);
if (CompilerControlUtils.check(log, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "excluded by") ||
CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "not compilable") ||
CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "disallowed by CompileCommand")
);
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "excluded by") ||
CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "not compilable") ||
CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "disallowed by CompileCommand")
);
}
}
}
}
| 4,104 | 41.319588 | 145 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlExcludeClassTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.runner.RunnerException;
@CompilerControl(Mode.EXCLUDE)
public class CompilerControlExcludeClassTest {
@Benchmark
public void compilerControlSpecimen() {}
@Test
public void test() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Class hint should exist",
CompilerControlUtils.hasHint(Mode.EXCLUDE.command(), className)
);
Assert.assertFalse("Method hint should not exist",
CompilerControlUtils.hasHint("", className, "compilerControlSpecimen")
);
}
}
| 2,084 | 37.611111 | 86 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlExcludeTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.RunnerException;
public class CompilerControlExcludeTest {
@CompilerControl(Mode.EXCLUDE)
void sampleMethod() {}
@Benchmark
@CompilerControl(Mode.EXCLUDE)
public void dummyTest() {
Fixtures.work();
}
@Test
public void testBenchmark() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on benchmark method",
CompilerControlUtils.hasHint(Mode.EXCLUDE.command(), className, "dummyTest"));
}
@Test
public void testStandalone() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on standalone method",
CompilerControlUtils.hasHint(Mode.EXCLUDE.command(), className, "sampleMethod"));
}
}
| 2,361 | 37.721311 | 97 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlInlineActualTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Collection;
public class CompilerControlInlineActualTest {
@CompilerControl(CompilerControl.Mode.INLINE)
public void strawMethod() {
}
public void trampoline() {
strawMethod();
}
@Benchmark
@CompilerControl(CompilerControl.Mode.INLINE)
public void compilerControlSpecimen() {
trampoline();
}
@Test
public void testBenchmark() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.addProfiler(LogConsumeProfiler.class)
.measurementIterations(mode == Mode.SingleShotTime ? 200_000 : 1)
.measurementTime(TimeValue.seconds(5))
.warmupIterations(0)
.forks(1)
.jvmArgsPrepend("-XX:CICompilerCount=2") // need to serialize the output properly
.build();
RunResult runResult = new Runner(opts).runSingle();
Collection<String> log = CompilerControlUtils.getLog(runResult);
if (CompilerControlUtils.check(log, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "force inline by"));
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "force inline by"));
}
}
}
}
| 3,532 | 37.824176 | 133 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlInlineClassTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.runner.RunnerException;
@CompilerControl(Mode.INLINE)
public class CompilerControlInlineClassTest {
@Benchmark
public void compilerControlSpecimen() {}
@Test
public void test() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Class hint should exist",
CompilerControlUtils.hasHint(Mode.INLINE.command(), className)
);
Assert.assertFalse("Method hint should not exist",
CompilerControlUtils.hasHint("", className, "compilerControlSpecimen")
);
}
}
| 2,081 | 37.555556 | 86 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlInlineTest.java | /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.RunnerException;
public class CompilerControlInlineTest {
@CompilerControl(Mode.INLINE)
void sampleMethod() {}
@Benchmark
@CompilerControl(Mode.INLINE)
public void dummyTest() {
Fixtures.work();
}
@Test
public void testBenchmark() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on benchmark method",
CompilerControlUtils.hasHint(Mode.INLINE.command(), className, "dummyTest"));
}
@Test
public void testStandalone() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on standalone method",
CompilerControlUtils.hasHint(Mode.INLINE.command(), className, "sampleMethod"));
}
}
| 2,356 | 37.639344 | 96 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlNestedTest.java | /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.annotations.CompilerControl.Mode;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.RunnerException;
public class CompilerControlNestedTest {
@CompilerControl(Mode.INLINE)
public static class SpecimenClass {
void sampleMethod() {}
}
public static class SpecimenMethod {
@CompilerControl(Mode.INLINE)
void sampleMethod() {}
}
@Benchmark
public void dummyTest() {
Fixtures.work();
}
@Test
public void testClass() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on nested class",
CompilerControlUtils.hasHint(Mode.INLINE.command(), className, "$SpecimenClass.*"));
}
@Test
public void testMethod() throws RunnerException {
String className = this.getClass().getName().replace(".", "/");
Assert.assertTrue("Has hint on nested class",
CompilerControlUtils.hasHint(Mode.INLINE.command(), className, "$SpecimenMethod", "sampleMethod"));
}
}
| 2,499 | 35.764706 | 115 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlUtils.java | /*
* Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.CompilerHints;
import java.util.Collection;
public class CompilerControlUtils {
public static Collection<String> getLog(RunResult runResult) {
LogConsumeProfiler.LogConsumeResult r = (LogConsumeProfiler.LogConsumeResult) runResult.getSecondaryResults().get("logout");
return r.getLines();
}
public static boolean check(Collection<String> log, String... checkFor) {
line: for (String line : log) {
System.out.println(line);
for (String m : checkFor) {
if (!line.contains(m)) continue line;
}
return true;
}
return false;
}
public static boolean hasHint(String hint, String... filters) {
nextHint:
for (String s : CompilerHints.defaultList().get()) {
for (String f : filters) {
if (!s.contains(f)) continue nextHint;
}
if (s.startsWith(hint)) {
return true;
}
}
return false;
}
}
| 2,347 | 35.6875 | 132 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/LogConsumeProfiler.java | /*
* Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.ccontrol;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.profile.ExternalProfiler;
import org.openjdk.jmh.results.*;
import org.openjdk.jmh.util.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
public class LogConsumeProfiler implements ExternalProfiler {
@Override
public Collection<String> addJVMInvokeOptions(BenchmarkParams params) {
return Collections.emptyList();
}
@Override
public Collection<String> addJVMOptions(BenchmarkParams params) {
return Arrays.asList("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintCompilation", "-XX:+PrintInlining");
}
@Override
public void beforeTrial(BenchmarkParams benchmarkParams) {
}
@Override
public Collection<? extends Result> afterTrial(BenchmarkResult br, long pid, File stdOut, File stdErr) {
try {
return Arrays.asList(
new LogConsumeResult("out", FileUtils.readAllLines(stdOut)),
new LogConsumeResult("err", FileUtils.readAllLines(stdErr))
);
} catch (IOException e) {
// skip
}
return Collections.emptyList();
}
@Override
public boolean allowPrintOut() {
return false;
}
@Override
public boolean allowPrintErr() {
return false;
}
@Override
public String getDescription() {
return "Log aggregating profiler";
}
public static class LogConsumeResult extends Result<LogConsumeResult> {
private final Collection<String> lines;
public LogConsumeResult(String label, Collection<String> lines) {
super(ResultRole.SECONDARY, "log" + label, of(Double.NaN), "N/A", AggregationPolicy.MAX);
this.lines = lines;
}
public Collection<String> getLines() {
return lines;
}
@Override
protected Aggregator<LogConsumeResult> getThreadAggregator() {
return new LogAggregator();
}
@Override
protected Aggregator<LogConsumeResult> getIterationAggregator() {
return new LogAggregator();
}
public static class LogAggregator implements Aggregator<LogConsumeResult> {
@Override
public LogConsumeResult aggregate(Collection<LogConsumeResult> results) {
String label = null;
Collection<String> allLines = new ArrayList<>();
for (LogConsumeResult r : results) {
label = r.label;
allLines.addAll(r.getLines());
}
return new LogConsumeResult(label, allLines);
}
}
}
}
| 4,047 | 32.454545 | 110 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/control/ControlStartStopTest.java | /*
* Copyright (c) 2016, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.control;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Control;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
@Warmup(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
public class ControlStartStopTest {
@Benchmark
public void ping(Control cnt) {
boolean stop = cnt.stopMeasurement;
boolean start = cnt.startMeasurement;
// stop should always be preceded by start
Assert.assertFalse(stop && !start);
}
@Test
public void invokeAPI() throws RunnerException {
for (Mode m : Mode.values()) {
if (m == Mode.All) continue;
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.mode(m)
.build();
new Runner(opt).runSingle();
}
}
}
| 2,461 | 36.30303 | 76 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/control/ControlStopTest.java | /*
* Copyright (c) 2016, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.control;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Control;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
@Warmup(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
public class ControlStopTest {
@Benchmark
@Group("pingpong")
public void ping(Control cnt) {
while (!cnt.stopMeasurement) {
Thread.yield();
}
}
@Benchmark
@Group("pingpong")
public void pong(Control cnt) {
while (!cnt.stopMeasurement) {
Thread.yield();
}
}
@Test
public void invokeAPI() throws RunnerException {
for (Mode m : Mode.values()) {
if (m == Mode.All) continue;
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.mode(m)
.build();
new Runner(opt).runSingle();
}
}
}
| 2,503 | 33.777778 | 76 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/BenchmarkIterationDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class BenchmarkIterationDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Benchmark)
public static class S3 {
@Setup(Level.Iteration)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S2 {
@Setup(Level.Iteration)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S1 {
@Setup(Level.Iteration)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@Threads(1)
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,629 | 33.81203 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/BenchmarkTrialDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class BenchmarkTrialDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Benchmark)
public static class S3 {
@Setup(Level.Trial)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S2 {
@Setup(Level.Trial)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S1 {
@Setup(Level.Trial)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@Threads(1)
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,601 | 33.601504 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedBGTIterationDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedBGTIterationDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Thread)
public static class S3 {
@Setup(Level.Iteration)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Group)
public static class S2 {
@Setup(Level.Iteration)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S1 {
@Setup(Level.Iteration)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@Threads(1)
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,133 | 32.885246 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedBGTTrialDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedBGTTrialDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Thread)
public static class S3 {
@Setup(Level.Trial)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Group)
public static class S2 {
@Setup(Level.Trial)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S1 {
@Setup(Level.Trial)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@Threads(1)
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,105 | 32.655738 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedBTGIterationDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedBTGIterationDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Group)
public static class S3 {
@Setup(Level.Iteration)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Thread)
public static class S2 {
@Setup(Level.Iteration)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S1 {
@Setup(Level.Iteration)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@Threads(1)
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,133 | 32.885246 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedBTGTrialDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedBTGTrialDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Group)
public static class S3 {
@Setup(Level.Trial)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Thread)
public static class S2 {
@Setup(Level.Trial)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S1 {
@Setup(Level.Trial)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@Threads(1)
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,105 | 32.655738 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedGBTIterationDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedGBTIterationDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Thread)
public static class S3 {
@Setup(Level.Iteration)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S2 {
@Setup(Level.Iteration)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Group)
public static class S1 {
@Setup(Level.Iteration)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@GroupThreads(1)
@Group
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,149 | 32.739837 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedGBTTrialDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedGBTTrialDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Thread)
public static class S3 {
@Setup(Level.Trial)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S2 {
@Setup(Level.Trial)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Group)
public static class S1 {
@Setup(Level.Trial)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@GroupThreads(1)
@Group
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,121 | 32.512195 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedGTBIterationDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedGTBIterationDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Benchmark)
public static class S3 {
@Setup(Level.Iteration)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Thread)
public static class S2 {
@Setup(Level.Iteration)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Group)
public static class S1 {
@Setup(Level.Iteration)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@GroupThreads(1)
@Group
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,149 | 32.739837 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedGTBTrialDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedGTBTrialDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Benchmark)
public static class S3 {
@Setup(Level.Trial)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Thread)
public static class S2 {
@Setup(Level.Trial)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Group)
public static class S1 {
@Setup(Level.Trial)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Trial)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@GroupThreads(1)
@Group
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,121 | 32.512195 | 88 | java |
jmh | jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedTBGIterationDagOrderTest.java | /*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.it.dagorder;
import org.junit.Assert;
import org.junit.Test;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.it.Fixtures;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class MixedTBGIterationDagOrderTest {
public static final AtomicInteger TICKER = new AtomicInteger();
private static volatile int s1setup, s1teardown;
private static volatile int s2setup, s2teardown;
private static volatile int s3setup, s3teardown;
private static volatile int run;
@State(Scope.Group)
public static class S3 {
@Setup(Level.Iteration)
public void setupInstance() {
s3setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s3teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Benchmark)
public static class S2 {
@Setup(Level.Iteration)
public void setupInstance(S3 s3) {
s2setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s2teardown = TICKER.incrementAndGet();
}
}
@State(Scope.Thread)
public static class S1 {
@Setup(Level.Iteration)
public void setupInstance(S2 s2) {
s1setup = TICKER.incrementAndGet();
}
@TearDown(Level.Iteration)
public void tearDownInstance() {
s1teardown = TICKER.incrementAndGet();
}
}
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
@Threads(1)
public void test(S1 state) {
run = TICKER.incrementAndGet();
Fixtures.work();
}
@Test
public void invokeAPI() throws RunnerException {
for (int c = 0; c < Fixtures.repetitionCount(); c++) {
Options opt = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.shouldFailOnError(true)
.syncIterations(false)
.build();
new Runner(opt).run();
Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup);
Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup);
Assert.assertTrue(s1setup + " < " + run, s1setup < run);
Assert.assertTrue(run + " < " + s1teardown, run < s1teardown);
Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown);
Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown);
}
}
}
| 4,133 | 32.885246 | 88 | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.