仅运行testMethod()的JMH Benchmark

时间:2018-09-10 12:17:51

标签: java jmh

公共类MyBenchmark {

@Benchmark
public void otherMethod() {
}

@Benchmark
public void sessionCreation() {
}

public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder().include(MyBenchmark.class.getSimpleName()).forks(1).build();
    new Runner(opt).run();
}

运行到以下错误:

java.lang.NoSuchMethodError: tesco.finance.gss.generated.MyBenchmark_jmhType.testMethod()V
    at tesco.finance.gss.generated.MyBenchmark_testMethod_jmhTest.testMethod_thrpt_jmhStub(MyBenchmark_testMethod_jmhTest.java:119)
    at tesco.finance.gss.generated.MyBenchmark_testMethod_jmhTest.testMethod_Throughput(MyBenchmark_testMethod_jmhTest.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:453)
    at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:437)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

0 个答案:

没有答案