org.HdrHistogram.Recorder.getIntervalHistogram()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.HdrHistogram.Recorder.getIntervalHistogram方法的一些代码示例,展示了Recorder.getIntervalHistogram的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Recorder.getIntervalHistogram方法的具体详情如下:
包路径:org.HdrHistogram.Recorder
类名称:Recorder
方法名:getIntervalHistogram

Recorder.getIntervalHistogram介绍

暂无

代码示例

代码示例来源:origin: HdrHistogram/HdrHistogram

/**
 * Get a new instance of an interval histogram, which will include a stable, consistent view of all value
 * counts accumulated since the last interval histogram was taken.
 * <p>
 * Calling {@link Recorder#getIntervalHistogram()} will reset
 * the value counts, and start accumulating value counts for the next interval.
 *
 * @return a histogram containing the value counts accumulated since the last interval histogram was taken.
 */
public synchronized Histogram getIntervalHistogram() {
  return getIntervalHistogram(null);
}

代码示例来源:origin: networknt/light-4j

/**
 * Create a reservoir with a user-specified recorder.
 *
 * @param recorder Recorder to use
 */
public HdrHistogramResetOnSnapshotReservoir(Recorder recorder) {
  this.recorder = recorder;
  /*
   * Start by flipping the recorder's interval histogram.
   * - it starts our counting at zero. Arguably this might be a bad thing if you wanted to feed in
   *   a recorder that already had some measurements? But that seems crazy.
   * - intervalHistogram can be nonnull.
   */
  intervalHistogram = recorder.getIntervalHistogram();
}

代码示例来源:origin: HdrHistogram/HdrHistogram

return getIntervalHistogram(histogramToRecycle, true);

代码示例来源:origin: brianfrankcooper/YCSB

private Histogram getIntervalHistogramAndAccumulate() {
 Histogram intervalHistogram = histogram.getIntervalHistogram();
 // add this to the total time histogram.
 if (totalHistogram == null) {
  totalHistogram = intervalHistogram;
 } else {
  totalHistogram.add(intervalHistogram);
 }
 return intervalHistogram;
}

代码示例来源:origin: networknt/light-4j

/**
   * @return a copy of the accumulated state since the reservoir last had a snapshot
   */
  @Nonnull
  private synchronized Histogram getDataSinceLastSnapshotAndReset() {
    intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);
    return intervalHistogram.copy();
  }
}

代码示例来源:origin: linkedin/parseq

/**
 * Allows consuming histogram and returning a result.
 * Histogram passed to the consumer includes stable, consistent view
 * of all values accumulated since last harvest.
 * This method is thread safe.
 * @param consumer consumer for a harvested histogram
 * @param <T> return type of a passed in function
 * @return a result of a passed in function
 */
public synchronized <T> T harvest(Function<Histogram, T> consumer) {
 initializeRecorder();
 _recycle = _recorder.getIntervalHistogram(_recycle);
 return consumer.apply(_recycle);
}

代码示例来源:origin: linkedin/parseq

/**
  * Allows consuming histogram and returning a result.
  * Histogram passed to the consumer includes stable, consistent view
  * of all values accumulated since last harvest.
  * This method is thread safe.
  * @param consumer consumer for a harvested histogram
  * @param <T> return type of a passed in function
  * @return a result of a passed in function
  */
 public synchronized <T> T harvest(Function<Histogram, T> consumer) {
  initializeRecorder();
  _recycle = _recorder.getIntervalHistogram(_recycle);
  return consumer.apply(_recycle);
 }
}

代码示例来源:origin: networknt/light-4j

/**
   * @return a copy of the accumulated state since the reservoir was created
   */
  @Nonnull
  private synchronized Histogram updateRunningTotals() {
    intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);
    runningTotals.add(intervalHistogram);
    return runningTotals.copy();
  }
}

代码示例来源:origin: networknt/light-4j

/**
 * Create a reservoir with a user-specified recorder.
 *
 * @param recorder Recorder to use
 */
public HdrHistogramReservoir(Recorder recorder) {
  this.recorder = recorder;
  /*
   * Start by flipping the recorder's interval histogram.
   * - it starts our counting at zero. Arguably this might be a bad thing if you wanted to feed in
   *   a recorder that already had some measurements? But that seems crazy.
   * - intervalHistogram can be nonnull.
   * - it lets us figure out the number of significant digits to use in runningTotals.
   */
  intervalHistogram = recorder.getIntervalHistogram();
  runningTotals = new Histogram(intervalHistogram.getNumberOfSignificantValueDigits());
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

Histogram newHistogram = recorder.getIntervalHistogram(staleHistogram);
future.set(newHistogram);
return newHistogram;

代码示例来源:origin: rsocket/rsocket-java

public Recorder startTracker(Duration interval) {
 final Recorder histogram = new Recorder(3600000000000L, 3);
 Flux.interval(interval)
   .doOnNext(
     aLong -> {
      System.out.println("---- PING/ PONG HISTO ----");
      histogram
        .getIntervalHistogram()
        .outputPercentileDistribution(System.out, 5, 1000.0, false);
      System.out.println("---- PING/ PONG HISTO ----");
     })
   .subscribe();
 return histogram;
}

代码示例来源:origin: org.hdrhistogram/HdrHistogram

/**
 * Get a new instance of an interval histogram, which will include a stable, consistent view of all value
 * counts accumulated since the last interval histogram was taken.
 * <p>
 * Calling {@link Recorder#getIntervalHistogram()} will reset
 * the value counts, and start accumulating value counts for the next interval.
 *
 * @return a histogram containing the value counts accumulated since the last interval histogram was taken.
 */
public synchronized Histogram getIntervalHistogram() {
  return getIntervalHistogram(null);
}

代码示例来源:origin: com.github.vladimir-bukhtoyarov/rolling-metrics

public ResetOnSnapshotAccumulator(Recorder recorder) {
  this.recorder = recorder;
  this.intervalHistogram = recorder.getIntervalHistogram();
}

代码示例来源:origin: com.github.vladimir-bukhtoyarov/rolling-metrics

Phase(Supplier<Recorder> recorderSupplier, long proposedInvalidationTimestamp) {
  this.recorder = recorderSupplier.get();
  this.intervalHistogram = recorder.getIntervalHistogram();
  this.totalsHistogram = intervalHistogram.copy();
  this.proposedInvalidationTimestamp = proposedInvalidationTimestamp;
}

代码示例来源:origin: org.mpierce.metrics.reservoir/hdrhistogram-metrics-reservoir

/**
   * @return a copy of the accumulated state since the reservoir last had a snapshot
   */
  @Nonnull
  private synchronized Histogram getDataSinceLastSnapshotAndReset() {
    intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);
    return intervalHistogram.copy();
  }
}

代码示例来源:origin: org.mpierce.metrics.reservoir/hdrhistogram-metrics-reservoir

/**
   * @return a copy of the accumulated state since the reservoir was created
   */
  @Nonnull
  private synchronized Histogram updateRunningTotals() {
    intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);
    runningTotals.add(intervalHistogram);
    return runningTotals.copy();
  }
}

代码示例来源:origin: com.networknt/metrics

/**
   * @return a copy of the accumulated state since the reservoir was created
   */
  @Nonnull
  private synchronized Histogram updateRunningTotals() {
    intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);
    runningTotals.add(intervalHistogram);
    return runningTotals.copy();
  }
}

代码示例来源:origin: com.yahoo.pulsar/pulsar-broker

public void updateStats() {
  topicLoadHistogram = topicLoadTimeRecorder.getIntervalHistogram(topicLoadHistogram);
  this.elapsedIntervalMs = (TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - topicLoadRecordStartTime);
  topicLoadRecordStartTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
  this.meanTopicLoadMs = topicLoadHistogram.getMean();
  this.medianTopicLoadMs = topicLoadHistogram.getValueAtPercentile(50);
  this.topicLoad95Ms = topicLoadHistogram.getValueAtPercentile(95);
  this.topicLoad99Ms = topicLoadHistogram.getValueAtPercentile(99);
  this.topicLoad999Ms = topicLoadHistogram.getValueAtPercentile(99.9);
  this.topicsLoad9999Ms = topicLoadHistogram.getValueAtPercentile(99.99);
  this.topicLoadCounts = topicLoadHistogram.getTotalCount();
}

代码示例来源:origin: io.reactivesocket/reactivesocket-test

public Recorder startTracker(Duration interval) {
  final Recorder histogram = new Recorder(3600000000000L, 3);
  Flux.interval(interval)
      .doOnNext(aLong -> {
      System.out.println("---- PING/ PONG HISTO ----");
      histogram.getIntervalHistogram()
        .outputPercentileDistribution(System.out, 5, 1000.0, false);
      System.out.println("---- PING/ PONG HISTO ----");
    })
      .subscribe();
  return histogram;
}

代码示例来源:origin: org.apache.pulsar/pulsar-testclient

private static void printAggregatedStats() {
  Histogram reportHistogram = cumulativeRecorder.getIntervalHistogram();
  log.info(
      "Aggregated latency stats --- Latency: mean: {} ms - med: {} - 95pct: {} - 99pct: {} - 99.9pct: {} - 99.99pct: {} - 99.999pct: {} - Max: {}",
      dec.format(reportHistogram.getMean()), (long) reportHistogram.getValueAtPercentile(50),
      (long) reportHistogram.getValueAtPercentile(95), (long) reportHistogram.getValueAtPercentile(99),
      (long) reportHistogram.getValueAtPercentile(99.9), (long) reportHistogram.getValueAtPercentile(99.99),
      (long) reportHistogram.getValueAtPercentile(99.999), (long) reportHistogram.getMaxValue());
}

相关文章