Created
October 25, 2017 18:36
-
-
Save isicju/23c7a4a7b2f0988888ded22e0b6f34f9 to your computer and use it in GitHub Desktop.
making great benchmarking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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