Skip to content

Instantly share code, notes, and snippets.

@isicju
Created October 25, 2017 18:36
Show Gist options
  • Save isicju/f4c0acce0d274b0b39120dc0f163b706 to your computer and use it in GitHub Desktop.
Save isicju/f4c0acce0d274b0b39120dc0f163b706 to your computer and use it in GitHub Desktop.
making great benchmarking
package org.sample;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
public class MyBenchmark {
@Benchmark@BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS)
public void testMethod() {
doMagic();
}
public static void doMagic() {
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment