當前位置: 首頁>>代碼示例>>Java>>正文


Java Mode.SampleTime方法代碼示例

本文整理匯總了Java中org.openjdk.jmh.annotations.Mode.SampleTime方法的典型用法代碼示例。如果您正苦於以下問題:Java Mode.SampleTime方法的具體用法?Java Mode.SampleTime怎麽用?Java Mode.SampleTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openjdk.jmh.annotations.Mode的用法示例。


在下文中一共展示了Mode.SampleTime方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startEndRecordEventsRootSpan

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
 * This benchmark attempts to measure performance of start/end for a root {@code Span} with record
 * events option.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span startEndRecordEventsRootSpan() {
  Span span =
      tracer
          .spanBuilderWithExplicitParent(SPAN_NAME, null)
          .setSampler(Samplers.neverSample())
          .setRecordEvents(true)
          .startSpan();
  span.end();
  return span;
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:18,代碼來源:StartEndSpanBenchmark.java

示例2: measureSimpleClientGaugeLatencyWithLabels

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSimpleClientGaugeLatencyWithLabels() {
  promGauge = io.prometheus.client.Gauge.build().name("name").help("help").labelNames(LABEL_NAMES).create();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    promGauge.labels(LABEL_VALUES).inc();
  }
  actualIterations = promGauge.labels(LABEL_VALUES).get();
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:11,代碼來源:SettableGaugeLatencyTest.java

示例3: startEndSampledRootSpan

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
 * This benchmark attempts to measure performance of start/end for a sampled root {@code Span}.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span startEndSampledRootSpan() {
  Span span = tracer.spanBuilder(SPAN_NAME).setSampler(Samplers.alwaysSample()).startSpan();
  span.end();
  return span;
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:12,代碼來源:StartEndSpanBenchmark.java

示例4: measureSettableGaugeLatencyWithLabels

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSettableGaugeLatencyWithLabels() {
  gauge = new SettableGaugeBuilder("name", "help").withLabels("label1", "label2").build();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    gauge.set(i, LABEL_VALUES);
  }
  actualIterations = gauge.getValue(LABEL_VALUES) + 1;
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:11,代碼來源:SettableGaugeLatencyTest.java

示例5: measureSimpleClientGaugeLatency

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSimpleClientGaugeLatency() {
  promHistogram = io.prometheus.client.Histogram.build().name("name").help("help").create();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    promHistogram.observe(i);
  }
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:10,代碼來源:HistogramLatencyTest.java

示例6: addLink

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/** This benchmark attempts to measure performance of adding a link to the span. */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span addLink() {
  span.addLink(Link.fromSpanContext(linkedSpan.getContext(), Link.Type.PARENT_LINKED_SPAN));
  return span;
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:9,代碼來源:RecordTraceEventsSampledSpanBenchmark.java

示例7: fromBinarySpanContext

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
 * This benchmark attempts to measure performance of {@link BinaryFormat#fromBinaryValue(byte[])}.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public SpanContext fromBinarySpanContext() throws SpanContextParseException {
  return binaryFormat.fromByteArray(spanContextBinary);
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:10,代碼來源:BinaryPropagationImplBenchmark.java

示例8: measureSettableGaugeLatencyWithLabels

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSettableGaugeLatencyWithLabels() {
  histogram = new HistogramBuilder("name", "help").withLabels("label1", "label2").build();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    histogram.observe(i, LABEL_VALUES);
  }
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:10,代碼來源:HistogramLatencyTest.java

示例9: measureSimpleClientSummaryLatencyWithLabels

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSimpleClientSummaryLatencyWithLabels() {
  promSummary = io.prometheus.client.Summary.build().name("name").help("help").labelNames(LABEL_NAMES).create();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    promSummary.labels(LABEL_VALUES).observe(i);
  }
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:10,代碼來源:SummaryLatencyTest.java

示例10: measureSettableSummaryLatency

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSettableSummaryLatency() {
  summary = new SummaryBuilder("name", "help").build();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    summary.observe(i);
  }
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:10,代碼來源:SummaryLatencyTest.java

示例11: measureSettableSummaryLatencyWithLabels

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSettableSummaryLatencyWithLabels() {
  summary = new SummaryBuilder("name", "help").withLabels("label1", "label2").build();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    summary.observe(i, LABEL_VALUES);
  }
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:10,代碼來源:SummaryLatencyTest.java

示例12: toFromBinarySpanContext

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
 * This benchmark attempts to measure performance of {@link
 * BinaryFormat#toBinaryValue(SpanContext)} then {@link BinaryFormat#fromBinaryValue(byte[])}.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public SpanContext toFromBinarySpanContext() throws SpanContextParseException {
  return binaryFormat.fromByteArray(binaryFormat.toByteArray(spanContext));
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:11,代碼來源:BinaryPropagationImplBenchmark.java

示例13: startEndNonSampledChildSpan

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
 * This benchmark attempts to measure performance of start/end for a non-sampled child {@code
 * Span}.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span startEndNonSampledChildSpan() {
  Span span =
      tracer
          .spanBuilderWithExplicitParent(SPAN_NAME, rootSpan)
          .setSampler(Samplers.neverSample())
          .startSpan();
  span.end();
  return span;
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:17,代碼來源:StartEndSpanBenchmark.java

示例14: measureSimpleClientCounterLatency

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSimpleClientCounterLatency() {
  prometheusCounter = io.prometheus.client.Counter.build().name("name").help("help").create();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    prometheusCounter.inc();
  }
  actualIterations = prometheusCounter.labels().get();
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:11,代碼來源:CounterLatencyTest.java

示例15: measureSimpleClientCounterLatencyWithLabels

import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSimpleClientCounterLatencyWithLabels() {
  prometheusCounter = io.prometheus.client.Counter.build().name("name").help("help").labelNames(LABEL_NAMES).create();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    prometheusCounter.labels(LABEL_VALUES).inc();
  }
  actualIterations = prometheusCounter.labels(LABEL_VALUES).get();
}
 
開發者ID:outbrain,項目名稱:prometheus-client,代碼行數:11,代碼來源:CounterLatencyTest.java


注:本文中的org.openjdk.jmh.annotations.Mode.SampleTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。