StatusBenchmark.
| 27 | |
| 28 | /** StatusBenchmark. */ |
| 29 | @State(Scope.Benchmark) |
| 30 | public class AttachDetachBenchmark { |
| 31 | |
| 32 | private final Context.Key<Integer> key = Context.keyWithDefault("key", 9999); |
| 33 | private final Context cu = Context.current().withValue(key, 8888); |
| 34 | |
| 35 | /** |
| 36 | * Javadoc comment. |
| 37 | */ |
| 38 | @Benchmark |
| 39 | @BenchmarkMode(Mode.SampleTime) |
| 40 | @OutputTimeUnit(TimeUnit.NANOSECONDS) |
| 41 | @GroupThreads(6) |
| 42 | public int attachDetach() { |
| 43 | Context old = cu.attach(); |
| 44 | try { |
| 45 | return key.get(); |
| 46 | } finally { |
| 47 | Context.current().detach(old); |
| 48 | } |
| 49 | } |
| 50 | } |
nothing calls this directly
no test coverage detected