diff options
| author | Bogdan Drutu <bogdandrutu@gmail.com> | 2017-04-10 17:42:06 -0700 |
|---|---|---|
| committer | Bogdan Drutu <bogdandrutu@gmail.com> | 2017-04-11 16:26:32 -0700 |
| commit | 5546c091a2248861da04be6b34ce326ffaa230d6 (patch) | |
| tree | 7bd90238c98577d2ad8c7543f9755570ff5184f6 /benchmarks | |
| parent | 7aa9bf80ca2f09f33fdbc22687ce760a814b36bd (diff) | |
| download | platform_external_opencensus-java-5546c091a2248861da04be6b34ce326ffaa230d6.tar.gz platform_external_opencensus-java-5546c091a2248861da04be6b34ce326ffaa230d6.tar.bz2 platform_external_opencensus-java-5546c091a2248861da04be6b34ce326ffaa230d6.zip | |
Remove the support for HTTP format for the moment.
Diffstat (limited to 'benchmarks')
| -rw-r--r-- | benchmarks/src/jmh/java/com/google/instrumentation/trace/PropagationUtilBenchmark.java | 54 |
1 files changed, 7 insertions, 47 deletions
diff --git a/benchmarks/src/jmh/java/com/google/instrumentation/trace/PropagationUtilBenchmark.java b/benchmarks/src/jmh/java/com/google/instrumentation/trace/PropagationUtilBenchmark.java index 0a6c76cd..3b302186 100644 --- a/benchmarks/src/jmh/java/com/google/instrumentation/trace/PropagationUtilBenchmark.java +++ b/benchmarks/src/jmh/java/com/google/instrumentation/trace/PropagationUtilBenchmark.java @@ -13,6 +13,7 @@ package com.google.instrumentation.trace; +import java.io.IOException; import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; @@ -33,57 +34,17 @@ public class PropagationUtilBenchmark { private static final byte[] traceOptionsBytes = new byte[] {1}; private static final TraceOptions traceOptions = TraceOptions.fromBytes(traceOptionsBytes); private SpanContext spanContext; - private String spanContextStringHttp; private byte[] spanContextBinary; - - /** - * Setup function for benchmarks. - */ + /** Setup function for benchmarks. */ @Setup public void setUp() { spanContext = new SpanContext(traceId, spanId, traceOptions); - spanContextStringHttp = PropagationUtil.toHttpHeaderValue(spanContext); spanContextBinary = PropagationUtil.toBinaryValue(spanContext); } /** * This benchmark attempts to measure performance of {@link - * PropagationUtil#toHttpHeaderValue(SpanContext)}. - */ - @Benchmark - @BenchmarkMode(Mode.SampleTime) - @OutputTimeUnit(TimeUnit.NANOSECONDS) - public String toHttpHeaderValueSpanContext() { - return PropagationUtil.toHttpHeaderValue(spanContext); - } - - /** - * This benchmark attempts to measure performance of {@link - * PropagationUtil#fromHttpHeaderValue(CharSequence)}. - */ - @Benchmark - @BenchmarkMode(Mode.SampleTime) - @OutputTimeUnit(TimeUnit.NANOSECONDS) - public SpanContext fromHttpHeaderValueSpanContext() { - return PropagationUtil.fromHttpHeaderValue(spanContextStringHttp); - } - - /** - * This benchmark attempts to measure performance of {@link - * PropagationUtil#toHttpHeaderValue(SpanContext)} then {@link - * PropagationUtil#fromHttpHeaderValue(CharSequence)}. - */ - @Benchmark - @BenchmarkMode(Mode.SampleTime) - @OutputTimeUnit(TimeUnit.NANOSECONDS) - public SpanContext toFromHttpFormatSpanContext() { - return PropagationUtil.fromHttpHeaderValue( - PropagationUtil.toHttpHeaderValue(spanContext)); - } - - /** - * This benchmark attempts to measure performance of {@link * PropagationUtil#toBinaryValue(SpanContext)}. */ @Benchmark @@ -100,20 +61,19 @@ public class PropagationUtilBenchmark { @Benchmark @BenchmarkMode(Mode.SampleTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) - public SpanContext fromBinaryValueSpanContext() { + public SpanContext fromBinaryValueSpanContext() throws IOException { return PropagationUtil.fromBinaryValue(spanContextBinary); } /** * This benchmark attempts to measure performance of {@link - * PropagationUtil#toBinaryValue(SpanContext)} then - * {@link PropagationUtil#fromBinaryValue(byte[])}. + * PropagationUtil#toBinaryValue(SpanContext)} then {@link + * PropagationUtil#fromBinaryValue(byte[])}. */ @Benchmark @BenchmarkMode(Mode.SampleTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) - public SpanContext toFromBinarySpanContext() { - return PropagationUtil.fromBinaryValue( - PropagationUtil.toBinaryValue(spanContext)); + public SpanContext toFromBinarySpanContext() throws IOException { + return PropagationUtil.fromBinaryValue(PropagationUtil.toBinaryValue(spanContext)); } } |
