org.HdrHistogram.Histogram.getTotalCount()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(127)

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

Histogram.getTotalCount介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public long getCompleted() {
  return histo.getTotalCount();
}

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

@Override
public synchronized long getTotalCount() {
  return super.getTotalCount();
}

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

@Override
public int size() {
  return (int) histogram.getTotalCount();
}

代码示例来源:origin: lettuce-io/lettuce-core

private Map<CommandLatencyId, CommandMetrics> getMetrics(Map<CommandLatencyId, Latencies> latencyMetrics) {
  Map<CommandLatencyId, CommandMetrics> result = new TreeMap<>();
  for (Map.Entry<CommandLatencyId, Latencies> entry : latencyMetrics.entrySet()) {
    Latencies latencies = entry.getValue();
    Histogram firstResponse = latencies.getFirstResponseHistogram();
    Histogram completion = latencies.getCompletionHistogram();
    if (firstResponse.getTotalCount() == 0 && completion.getTotalCount() == 0) {
      continue;
    }
    CommandLatency firstResponseLatency = getMetric(firstResponse);
    CommandLatency completionLatency = getMetric(completion);
    CommandMetrics metrics = new CommandMetrics(firstResponse.getTotalCount(), options.targetUnit(),
        firstResponseLatency, completionLatency);
    result.put(entry.getKey(), metrics);
  }
  return result;
}

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

@Override
public long[] getValues() {
  long[] vals = new long[(int) histogram.getTotalCount()];
  int i = 0;
  for (HistogramIterationValue value : histogram.recordedValues()) {
    long val = value.getValueIteratedTo();
    for (int j = 0; j < value.getCountAddedInThisIterationStep(); j++) {
      vals[i] = val;
      i++;
    }
  }
  if (i != vals.length) {
    throw new IllegalStateException(
      "Total count was " + histogram.getTotalCount() + " but iterating values produced " + vals.length);
  }
  return vals;
}

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

/**
 * This is called periodically from the StatusThread. There's a single
 * StatusThread per Client process. We optionally serialize the interval to
 * log on this opportunity.
 *
 * @see com.yahoo.ycsb.measurements.OneMeasurement#getSummary()
 */
@Override
public String getSummary() {
 Histogram intervalHistogram = getIntervalHistogramAndAccumulate();
 // we use the summary interval as the histogram file interval.
 if (histogramLogWriter != null) {
  histogramLogWriter.outputIntervalHistogram(intervalHistogram);
 }
 DecimalFormat d = new DecimalFormat("#.##");
 return "[" + getName() + ": Count=" + intervalHistogram.getTotalCount() + ", Max="
   + intervalHistogram.getMaxValue() + ", Min=" + intervalHistogram.getMinValue() + ", Avg="
   + d.format(intervalHistogram.getMean()) + ", 90=" + d.format(intervalHistogram.getValueAtPercentile(90))
   + ", 99=" + d.format(intervalHistogram.getValueAtPercentile(99)) + ", 99.9="
   + d.format(intervalHistogram.getValueAtPercentile(99.9)) + ", 99.99="
   + d.format(intervalHistogram.getValueAtPercentile(99.99)) + "]";
}

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

((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()),
((Histogram) intervalHistogram).getTotalCount(),
((Histogram) intervalHistogram).getValueAtPercentile(50.0) / config.outputValueUnitRatio,
((Histogram) intervalHistogram).getValueAtPercentile(90.0) / config.outputValueUnitRatio,
((Histogram) intervalHistogram).getMaxValue() / config.outputValueUnitRatio,
accumulatedRegularHistogram.getTotalCount(),
accumulatedRegularHistogram.getValueAtPercentile(50.0) / config.outputValueUnitRatio,
accumulatedRegularHistogram.getValueAtPercentile(90.0) / config.outputValueUnitRatio,
((intervalHistogram.getEndTimeStamp() / 1000.0) - logReader.getStartTimeSec()),
((Histogram) movingWindowSumHistogram).getTotalCount(),
((Histogram) movingWindowSumHistogram).getValueAtPercentile(config.movingWindowPercentileToReport) / config.outputValueUnitRatio,
((Histogram) movingWindowSumHistogram).getMaxValue() / config.outputValueUnitRatio

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

exporter.write(getName(), "Operations", totalHistogram.getTotalCount());
exporter.write(getName(), "AverageLatency(us)", totalHistogram.getMean());
exporter.write(getName(), "MinLatency(us)", totalHistogram.getMinValue());

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

/**
 * Returns the request latency at a given percentile.
 *
 * @param host the host (if this is relevant in the way percentiles are categorized).
 * @param statement the statement (if this is relevant in the way percentiles are categorized).
 * @param exception the exception (if this is relevant in the way percentiles are categorized).
 * @param percentile the percentile (for example, {@code 99.0} for the 99th percentile).
 * @return the latency (in milliseconds) at the given percentile, or a negative value if it's not
 *     available yet.
 * @see #computeKey(Host, Statement, Exception)
 */
public long getLatencyAtPercentile(
  Host host, Statement statement, Exception exception, double percentile) {
 checkArgument(
   percentile >= 0.0 && percentile < 100,
   "percentile must be between 0.0 and 100 (was %s)",
   percentile);
 Histogram histogram = getLastIntervalHistogram(host, statement, exception);
 if (histogram == null || histogram.getTotalCount() < minRecordedValues) return -1;
 return histogram.getValueAtPercentile(percentile);
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@UserAggregationResult
  public List<Number> result() {
    long totalCount = values != null ? values.getTotalCount() : doubles.getTotalCount();
    boolean empty = totalCount == 0;
    List<Number> result = new ArrayList<>(percentiles.size());
    for (Double percentile : percentiles) {
      if (percentile == null || empty) {
        result.add(null);
      } else {
        if (values != null) {
          result.add(values.getValueAtPercentile(percentile * 100D));
        } else {
          result.add(doubles.getValueAtPercentile(percentile * 100D));
        }
      }
    }
    return result;
  }
}

代码示例来源:origin: PipelineAI/pipeline

p100 = (int) underlying.getValueAtPercentile(100);
totalCount = underlying.getTotalCount();

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@UserAggregationResult
  public Map<String,Number> result() {
    long totalCount = values != null ? values.getTotalCount() : doubles.getTotalCount();
    boolean empty = totalCount == 0;
    Map<String,Number> result = new LinkedHashMap<>(percentiles.size()+6);
    result.put("min",values != null ? (Number)values.getMinValue() : (Number)doubles.getMinValue());
    result.put("minNonZero",values != null ? (Number)values.getMinNonZeroValue() : (Number)doubles.getMinNonZeroValue());
    result.put("max",values != null ? (Number)values.getMaxValue() : (Number)doubles.getMaxValue());
    result.put("total",totalCount);
    result.put("mean",values != null ? values.getMean() : doubles.getMean());
    result.put("stdev",values != null ? values.getStdDeviation() : doubles.getStdDeviation());
    for (Double percentile : percentiles) {
      if (percentile != null && !empty) {
        if (values != null) {
          result.put(percentile.toString(), values.getValueAtPercentile(percentile * 100D));
        } else {
          result.put(percentile.toString(), doubles.getValueAtPercentile(percentile * 100D));
        }
      }
    }
    return result;
  }
}

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

@Override
public synchronized long getTotalCount() {
  return super.getTotalCount();
}

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

public static Snapshot getSnapshot(Histogram histogram, Function<Histogram, Snapshot> snapshotTaker) {
  if (histogram.getTotalCount() > 0) {
    return snapshotTaker.apply(histogram);
  } else {
    return EmptySnapshot.INSTANCE;
  }
}

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

public static Snapshot getSnapshot(Histogram histogram, Function<Histogram, Snapshot> snapshotTaker) {
  if (histogram.getTotalCount() > 0) {
    return snapshotTaker.apply(histogram);
  } else {
    return EmptySnapshot.INSTANCE;
  }
}

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

public static void reset(Histogram histogram) {
  if (histogram.getTotalCount() > 0) {
    histogram.reset();
  }
}

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

public static void addSecondToFirst(Histogram first, Histogram second) {
  if (second.getTotalCount() > 0) {
    first.add(second);
  }
}

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

public static void reset(Histogram histogram) {
  if (histogram.getTotalCount() > 0) {
    histogram.reset();
  }
}

代码示例来源: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: real-logic/artio

private void readsHistogram(final int expectedCount) throws IOException
{
  reset(logHandler);
  assertEquals(1, reader.read(logHandler));
  verify(logHandler, times(1)).onHistogram(anyLong(), eq(NAME), histogramCaptor.capture());
  assertEquals("Histogram returns unexpected count", expectedCount, histogram().getTotalCount());
}

相关文章