Created
November 15, 2017 19:48
-
-
Save alexandrnikitin/3dbcfa48762c02c6db32655679563644 to your computer and use it in GitHub Desktop.
JMH
This file contains hidden or 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 com; | |
import org.junit.Ignore; | |
import org.junit.Test; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.Scope; | |
import org.openjdk.jmh.annotations.Setup; | |
import org.openjdk.jmh.annotations.State; | |
import org.openjdk.jmh.infra.Blackhole; | |
import org.openjdk.jmh.profile.GCProfiler; | |
import org.openjdk.jmh.runner.Runner; | |
import org.openjdk.jmh.runner.options.Options; | |
import org.openjdk.jmh.runner.options.OptionsBuilder; | |
@State(Scope.Benchmark) | |
@Ignore("Benchmark") | |
public class Benchmark { | |
private AeroRecordToCookieProfileRecord sut; | |
@Test | |
public void run() throws Exception { | |
Options opt = new OptionsBuilder() | |
.include(this.getClass().getName() + ".*") | |
.warmupIterations(3) | |
.measurementIterations(10) | |
.threads(1) | |
.forks(1) | |
.shouldFailOnError(true) | |
.shouldDoGC(true) | |
//.jvmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining") | |
.addProfiler(GCProfiler.class) | |
.build(); | |
new Runner(opt).run(); | |
} | |
@Setup | |
public void setup() throws Exception { | |
this.sut = ; | |
} | |
@Benchmark | |
public void test(Blackhole bh) { | |
bh.consume(sut.apply()); | |
} | |
} |
This file contains hidden or 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
jmh:run -i 20 -wi 20 -f1 -t1 -prof xperfasm .*AlgoBenchmark.* | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment