繰り返し回数はさまざまなJMHモードに依存します。私はAvgtimeモードを使用しなければならないと考えています。さまざまな繰り返しを実行します。 /////////////////////////////////////////////////////////////////////// /////////////////////////////
Mode.Throughput: Calculate number of operations in a time unit.
Mode.AverageTime: Calculate an average running time.
Mode.SampleTime: Calculate how long does it take for a method to run
(including percentiles).
Mode.SingleShotTime: Just runs a method
once (useful for cold-testing mode).
/////////// /////////////////////////////////////////////////////////////////使用例モード「Mode.SingleShotTime」については///////////////////
、それはあなたが実行中で言及した回の繰り返し正確に数を実行します(下記参照) 。 //例ランナークラス
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_01_HelloWorld.class.getSimpleName())
.warmupIterations(1)// number of times the warmup iteration should take place
.measurementIterations(1)//number of times the actual iteration should take place
.forks(1)
.shouldDoGC(true)
.build();
new Runner(opt).run();
}