com.codahale.metrics.Snapshot.getValues()方法的使用及代码示例

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

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

Snapshot.getValues介绍

[英]Returns the entire set of values in the snapshot.
[中]返回快照中的整个值集。

代码示例

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

@Override
public long[] getValues() {
  return snapshot.getValues();
}

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

@Override
  public Double getValue() {
    Snapshot snapshot = processedDurationHistogram.getSnapshot();
    double meanProcessTime = snapshot.getMean();
    int numProcessed = snapshot.getValues().length;
    return  (numProcessed * meanProcessTime) / timeUnit.toMillis(window);
  }
}

代码示例来源:origin: alibaba/jstorm

/**
 * flush temp histogram data to all windows & assoc metrics.
 */
protected void doFlush() {
  long[] values = unFlushed.getSnapshot().getValues();
  for (JHistogram histogram : histogramMap.values()) {
    for (long val : values) {
      histogram.update(val);
    }
  }
  if (MetricUtils.metricAccurateCal) {
    for (long val : values) {
      for (AsmMetric metric : this.assocMetrics) {
        metric.updateDirectly(val);
      }
    }
  }
  this.unFlushed = newHistogram();
}

代码示例来源:origin: jooby-project/jooby

private static Map<String, Object> snapshot(final Sampling sampling, final double durationFactor,
  final boolean showSamples) {
 Map<String, Object> result = new TreeMap<>();
 final Snapshot snapshot = sampling.getSnapshot();
 result.put("max", snapshot.getMax() * durationFactor);
 result.put("mean", snapshot.getMean() * durationFactor);
 result.put("min", snapshot.getMin() * durationFactor);
 result.put("p50", snapshot.getMedian() * durationFactor);
 result.put("p75", snapshot.get75thPercentile() * durationFactor);
 result.put("p95", snapshot.get95thPercentile() * durationFactor);
 result.put("p98", snapshot.get98thPercentile() * durationFactor);
 result.put("p99", snapshot.get99thPercentile() * durationFactor);
 result.put("p999", snapshot.get999thPercentile() * durationFactor);
 if (showSamples) {
  final long[] values = snapshot.getValues();
  List<Double> scaledValues = new ArrayList<>(values.length);
  for (long value : values) {
   scaledValues.add(value * durationFactor);
  }
  result.put("values", scaledValues);
 }
 return result;
}

代码示例来源:origin: alibaba/jstorm

snapshot.set_points(MetricUtils.longs2bytes(snapshot1.getValues()));

代码示例来源:origin: alibaba/jstorm

byte[] points = longs2bytes(ws.getValues());
  ret.set_pointSize(ws.getValues().length);
} else {
  ret.set_points(new byte[0]);

代码示例来源:origin: palantir/atlasdb

@VisibleForTesting
Long getOutcomeCount(BackgroundCompactor.CompactionOutcome outcome) {
  if (outcome == BackgroundCompactor.CompactionOutcome.SHUTDOWN) {
    return shutdown ? 1L : 0L;
  }
  return Arrays.stream(reservoir.getSnapshot().getValues())
      .filter(l -> l == outcome.ordinal())
      .count();
}

代码示例来源:origin: palantir/atlasdb

private Long getOutcomeCount(SweepOutcome outcome) {
  if (outcome == SweepOutcome.SHUTDOWN) {
    return shutdown ? 1L : 0L;
  }
  if (outcome == SweepOutcome.FATAL) {
    return fatal ? 1L : 0L;
  }
  return Arrays.stream(reservoir.getSnapshot().getValues())
      .filter(l -> l == outcome.ordinal())
      .count();
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public List<Double> dumpTimings(String hostname) throws UnknownHostException
{
  InetAddress host = InetAddress.getByName(hostname);
  ArrayList<Double> timings = new ArrayList<Double>();
  ExponentiallyDecayingReservoir sample = samples.get(host);
  if (sample != null)
  {
    for (double time: sample.getSnapshot().getValues())
      timings.add(time);
  }
  return timings;
}

代码示例来源:origin: jsevellec/cassandra-unit

@Override
  public long[] values()
  {
    return metric.getSnapshot().getValues();
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

public List<Double> dumpTimings(String hostname) throws UnknownHostException
{
  InetAddress host = InetAddress.getByName(hostname);
  ArrayList<Double> timings = new ArrayList<Double>();
  ExponentiallyDecayingReservoir sample = samples.get(host);
  if (sample != null)
  {
    for (double time: sample.getSnapshot().getValues())
      timings.add(time);
  }
  return timings;
}

代码示例来源:origin: com.codahale.metrics/metrics-core

@Override
  public long[] values() {
    return metric.getSnapshot().getValues();
  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

@Override
public long[] values()
{
  return metric.getSnapshot().getValues();
}

代码示例来源:origin: jsevellec/cassandra-unit

@Override
public long[] values()
{
  return metric.getSnapshot().getValues();
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

@Override
  public long[] values()
  {
    return metric.getSnapshot().getValues();
  }
}

代码示例来源:origin: io.vertx/vertx-dropwizard-metrics

@Override
 public long[] values() {
  return metric.getSnapshot().getValues();
 }
}

代码示例来源:origin: com.codahale.metrics/metrics-core

@Override
public long[] values() {
  return metric.getSnapshot().getValues();
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public List<Double> dumpTimings(String hostname) throws UnknownHostException
{
  InetAddress host = InetAddress.getByName(hostname);
  ArrayList<Double> timings = new ArrayList<Double>();
  ExponentiallyDecayingReservoir sample = samples.get(host);
  if (sample != null)
  {
    for (double time: sample.getSnapshot().getValues())
      timings.add(time);
  }
  return timings;
}

代码示例来源:origin: snazy/ohc

public void mergeTo(MergeableTimer timer)
{
  Histogram hist = this.histogram.getAndSet(new Histogram(new UniformReservoir()));
  for (long l : hist.getSnapshot().getValues())
    timer.histogram.update(l);
  timer.meter.mark(count.getAndSet(0L));
}

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

private long getTimerValue(Timer timer) {
  long[] values = timer.getSnapshot().getValues();
  // These get stored in nanoseconds but Cron is in milliseconds
  return TimeUnit.NANOSECONDS.toMillis(values[0]);
}

相关文章