Guest User

Untitled

a guest
Nov 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. package com;
  2.  
  3. import org.junit.Ignore;
  4. import org.junit.Test;
  5. import org.openjdk.jmh.annotations.Benchmark;
  6. import org.openjdk.jmh.annotations.Scope;
  7. import org.openjdk.jmh.annotations.Setup;
  8. import org.openjdk.jmh.annotations.State;
  9. import org.openjdk.jmh.infra.Blackhole;
  10. import org.openjdk.jmh.profile.GCProfiler;
  11. import org.openjdk.jmh.runner.Runner;
  12. import org.openjdk.jmh.runner.options.Options;
  13. import org.openjdk.jmh.runner.options.OptionsBuilder;
  14.  
  15. @State(Scope.Benchmark)
  16. @Ignore("Benchmark")
  17. public class Benchmark {
  18.  
  19. private AeroRecordToCookieProfileRecord sut;
  20.  
  21. @Test
  22. public void run() throws Exception {
  23. Options opt = new OptionsBuilder()
  24. .include(this.getClass().getName() + ".*")
  25. .warmupIterations(3)
  26. .measurementIterations(10)
  27. .threads(1)
  28. .forks(1)
  29. .shouldFailOnError(true)
  30. .shouldDoGC(true)
  31. //.jvmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining")
  32. .addProfiler(GCProfiler.class)
  33. .build();
  34.  
  35. new Runner(opt).run();
  36. }
  37.  
  38. @Setup
  39. public void setup() throws Exception {
  40. this.sut = ;
  41. }
  42.  
  43. @Benchmark
  44. public void test(Blackhole bh) {
  45. bh.consume(sut.apply());
  46. }
  47.  
  48. }
Add Comment
Please, Sign In to add comment