Last active
March 10, 2016 21:37
-
-
Save joaovicente/fcb4b4f9b0832bc8bdc4 to your computer and use it in GitHub Desktop.
Revisions
-
joaovicente revised this gist
Mar 10, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public class TracyBenchmark { @Measurement(iterations = 10, time = 4, timeUnit = TimeUnit.SECONDS) @Threads(5) @Fork(2) public void testInlineTracy(Blackhole bh) { Tracy.setContext(TASK_ID, OPT_ID, COMPONENT); Tracy.before(OUTER); Tracy.annotate(STATUS_NAME, STATUS_VALUE); -
joaovicente created this gist
Mar 10, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ package org.sample; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.infra.Blackhole; import java.util.concurrent.TimeUnit; import com.apm4all.tracy.Tracy; public class TracyBenchmark { static final String TASK_ID = "T-1234567890123456"; static final String OPT_ID = "O-123456"; static final String COMPONENT = "myAwsomeService"; static final String OUTER = "outer"; static final String STATUS_NAME = "status"; static final int STATUS_VALUE = 200; @Benchmark //@BenchmarkMode(Mode.All) @BenchmarkMode(Mode.SampleTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) @Warmup(iterations = 2, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 10, time = 4, timeUnit = TimeUnit.SECONDS) @Threads(5) @Fork(2) public void testMethodA(Blackhole bh) { Tracy.setContext(TASK_ID, OPT_ID, COMPONENT); Tracy.before(OUTER); Tracy.annotate(STATUS_NAME, STATUS_VALUE); Tracy.after(OUTER); for (String event : Tracy.getEventsAsJson()) { bh.consume(event); } Tracy.clearContext(); } }