org.openjdk.jmh.annotations.OutputTimeUnit Java Examples

The following examples show how to use org.openjdk.jmh.annotations.OutputTimeUnit. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RawKVGetBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void get() {
    ThreadLocalRandom random = ThreadLocalRandom.current();
    byte[] key = BytesUtil.writeUtf8("benchmark_" + random.nextInt(KEY_COUNT));
    this.kvStore.get(key, false, null);
}
 
Example #2
Source File: CallOptionsBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Adding custom call options, overwritting existing keys.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public CallOptions withOptionDuplicates() {
  CallOptions opts = allOpts;
  for (int i = 1; i < shuffledCustomOptions.size(); i++) {
    opts = opts.withOption(shuffledCustomOptions.get(i), "value2");
  }
  return opts;
}
 
Example #3
Source File: DefaultTracerBenchmarks.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({Mode.AverageTime})
@Fork(1)
@Measurement(iterations = 15, time = 1)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 5, time = 1)
public void measureSpanBuilding() {
  span = tracer.spanBuilder("span").startSpan();
}
 
Example #4
Source File: OutboundHeadersBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Http2Headers convertClientHeaders() {
  return Utils.convertClientHeaders(metadata, scheme, defaultPath, authority, Utils.HTTP_METHOD,
      userAgent);
}
 
Example #5
Source File: StatsTraceContextBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public StatsTraceContext newClientContext() {
  return StatsTraceContext.newClientContext(CallOptions.DEFAULT, emptyMetadata);
}
 
Example #6
Source File: MethodDescriptorBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/** Foo bar. */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public AsciiString old() {
  return new AsciiString("/" + method.getFullMethodName());
}
 
Example #7
Source File: DecompressorRegistryBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public byte[][] marshalOld() {
  Metadata m = new Metadata();
  m.put(
      GrpcUtil.MESSAGE_ACCEPT_ENCODING_KEY,
      InternalDecompressorRegistry.getRawAdvertisedMessageEncodings(reg));
  return TransportFrameUtil.toHttp2Headers(m);
}
 
Example #8
Source File: StatsTraceContextBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public StatsTraceContext newServerContext_empty() {
  return StatsTraceContext.newServerContext(
      serverStreamTracerFactories, methodName, emptyMetadata);
}
 
Example #9
Source File: StatusBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public byte[] messageEncodePlain() {
  return Status.MESSAGE_KEY.toBytes("Unexpected RST in stream");
}
 
Example #10
Source File: StatusBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public byte[] messageEncodeEscape() {
  return Status.MESSAGE_KEY.toBytes("Some Error\nWasabi and Horseradish are the same");
}
 
Example #11
Source File: EnabledBenchmark.java    From perfmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void attachKeyedTag_ss_localRef() {
  String bar = there;
  PerfMark.attachTag("hi", this, ignore -> bar);
}
 
Example #12
Source File: SpanBenchmark.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Threads(value = 2)
@Fork(1)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 10, time = 1)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void addAttributesEventsStatusEnd_02Threads() {
  doSpanWork(span);
}
 
Example #13
Source File: LongMinMaxSumCountBenchmark.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Fork(1)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 10, time = 1)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Threads(value = 10)
public void aggregate_10Threads() {
  aggregator.recordLong(100);
}
 
Example #14
Source File: SymSpellSearchBenchMark.java    From customized-symspell with MIT License 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Measurement(iterations = 1)
public void searchBenchmark() throws SpellCheckException {
  for (String query : queries) {
    totalMatches += spellChecker.lookup(query, Verbosity.valueOf(verbosity), maxEditDistance)
        .size();
  }
}
 
Example #15
Source File: PropagatorContextExtractBenchmark.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Measurement(iterations = 15, time = 1)
@Warmup(iterations = 5, time = 1)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@BenchmarkMode(Mode.AverageTime)
@Fork(1)
public Span measureExtract() {
  return TracingContextUtils.getSpan(doExtract());
}
 
Example #16
Source File: StatusBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public String messageDecodePlain() {
  return Status.MESSAGE_KEY.parseBytes(
      "Unexpected RST in stream".getBytes(Charset.forName("US-ASCII")));
}
 
Example #17
Source File: RawKVPutBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void put() {
    ThreadLocalRandom random = ThreadLocalRandom.current();
    byte[] key = BytesUtil.writeUtf8("benchmark_" + random.nextInt(KEY_COUNT));
    super.kvStore.put(key, VALUE_BYTES, null);
}
 
Example #18
Source File: MethodHandleGeneratorBenchmark.java    From perfmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public long getAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
Example #19
Source File: SpanBenchmark.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Threads(value = 5)
@Fork(1)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 10, time = 1)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void addAttributesEventsStatusEnd_05Threads() {
  doSpanWork(span);
}
 
Example #20
Source File: RheaKVGetBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void getReadOnlySafe() {
    ThreadLocalRandom random = ThreadLocalRandom.current();
    byte[] key = BytesUtil.writeUtf8("benchmark_" + random.nextInt(KEY_COUNT));
    this.kvStore.get(key, true);
}
 
Example #21
Source File: AbstractReferenceCountedByteBufBenchmark.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public boolean retainReleaseUncontended() {
    buf.retain();
    Blackhole.consumeCPU(delay);
    return buf.release();
}
 
Example #22
Source File: VarIntsBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void varInt64() {
    byte[] bytes = VarInts.writeVarInt64(SMALL_VAL);
    VarInts.readVarInt64(bytes);
}
 
Example #23
Source File: VarIntsBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void int64() {
    byte[] bytes = new byte[8];
    putLong(bytes, 0, SMALL_VAL);
    getLong(bytes, 0);
}
 
Example #24
Source File: VarHandleGeneratorBenchmark.java    From perfmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public long getAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
Example #25
Source File: DoubleMinMaxSumCountBenchmark.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Fork(1)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 10, time = 1)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Threads(value = 5)
public void aggregate_5Threads() {
  aggregator.recordDouble(100.0056);
}
 
Example #26
Source File: AsciiCodecBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void fastpathEncode() {
    // fast ptah
    AsciiStringUtil.unsafeEncode(PEER_STR);
}
 
Example #27
Source File: AsciiCodecBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void fastpathDecode() {
    // fast ptah
    AsciiStringUtil.unsafeDecode(PEER_BYTES);
}
 
Example #28
Source File: Utf8CodecBenchmark.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("all")
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void defaultToUtf8Bytes() {
    Utils.getBytes(str);
}
 
Example #29
Source File: EnabledBenchmark.java    From perfmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void startStop() {
  PerfMark.startTask("hi", TAG);
  PerfMark.stopTask("hi", TAG);
}
 
Example #30
Source File: CompressionUtilsBenchmark.java    From mantis with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MINUTES)
@Warmup(iterations = 10, time = 3, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 50, time = 3, timeUnit = TimeUnit.SECONDS)
@Threads(1)
public void testBasicStringSplit(Blackhole blackhole, MyState state) throws IOException {
    BufferedReader bf = new BufferedReader(new StringReader(state.eventListStr));

    StringBuilder sb = new StringBuilder();
    String line;
    List<String> msseList = new ArrayList<>();
    int dollarCnt = 0;
    while ((line = bf.readLine()) != null) {
        for (int i = 0; i < line.length(); i++) {
            if (dollarCnt == 3) {
                msseList.add(sb.toString());
                dollarCnt = 0;
                sb = new StringBuilder();
            }
            if (line.charAt(i) != '$') {
                sb.append(line.charAt(i));
            } else {
                dollarCnt++;
            }
        }

    }
    blackhole.consume(msseList);
    //blackhole.consume(state.eventListStr.split("$$"));
    //state.sum = state.a + state.b;
}