本文整理了Java中com.yammer.metrics.core.Timer.sum()
方法的一些代码示例,展示了Timer.sum()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.sum()
方法的具体详情如下:
包路径:com.yammer.metrics.core.Timer
类名称:Timer
方法名:sum
[英]Returns the sum of all recorded durations.
[中]返回所有记录的持续时间之和。
代码示例来源:origin: urbanairship/statshtable
@Override
public double sum() {
return t.sum();
}
}
代码示例来源:origin: amient/kafka-metrics
@Override
public void processTimer(MetricName name, Timer timer, Long timestamp) {
Map<String, Double> fields = new HashMap<String, Double>();
fields.put("Count", Double.valueOf(timer.count()));
fields.put("MeanRate", timer.meanRate());
fields.put("FifteenMinuteRate", timer.fifteenMinuteRate());
fields.put("FiveMinuteRate", timer.fiveMinuteRate());
fields.put("OneMinuteRate", timer.oneMinuteRate());
fields.put("Max", timer.max());
fields.put("Mean", timer.mean());
fields.put("Min", timer.min());
fields.put("StdDev", timer.stdDev());
fields.put("Sum", timer.sum());
publish(createMeasurement(name, timestamp, fixedTags, fields));
}
代码示例来源:origin: com.ngdata/hbase-indexer-mr
private void copyIndexingMetricsToCounters(Context context) {
final String COUNTER_GROUP = "HBase Indexer Metrics";
SortedMap<String, SortedMap<MetricName, Metric>> groupedMetrics = Metrics.defaultRegistry().groupedMetrics(
new IndexerMetricsUtil.IndexerMetricPredicate());
for (Entry<String, SortedMap<MetricName, Metric>> metricsGroupEntry : groupedMetrics.entrySet()) {
SortedMap<MetricName, Metric> metricsGroupMap = metricsGroupEntry.getValue();
for (Entry<MetricName, Metric> metricEntry : metricsGroupMap.entrySet()) {
MetricName metricName = metricEntry.getKey();
Metric metric = metricEntry.getValue();
String counterName = metricName.getType() + ": " + metricName.getName();
if (metric instanceof Counter) {
Counter counter = (Counter) metric;
context.getCounter(COUNTER_GROUP, counterName).increment(counter.count());
} else if (metric instanceof Meter) {
Meter meter = (Meter) metric;
context.getCounter(COUNTER_GROUP, counterName).increment(meter.count());
} else if (metric instanceof Timer) {
Timer timer = (Timer) metric;
context.getCounter(COUNTER_GROUP, counterName).increment((long) timer.sum());
}
}
}
}
代码示例来源:origin: NGDATA/hbase-indexer
private void copyIndexingMetricsToCounters(Context context) {
final String COUNTER_GROUP = "HBase Indexer Metrics";
SortedMap<String, SortedMap<MetricName, Metric>> groupedMetrics = Metrics.defaultRegistry().groupedMetrics(
new IndexerMetricsUtil.IndexerMetricPredicate());
for (Entry<String, SortedMap<MetricName, Metric>> metricsGroupEntry : groupedMetrics.entrySet()) {
SortedMap<MetricName, Metric> metricsGroupMap = metricsGroupEntry.getValue();
for (Entry<MetricName, Metric> metricEntry : metricsGroupMap.entrySet()) {
MetricName metricName = metricEntry.getKey();
Metric metric = metricEntry.getValue();
String counterName = metricName.getType() + ": " + metricName.getName();
if (metric instanceof Counter) {
Counter counter = (Counter) metric;
context.getCounter(COUNTER_GROUP, counterName).increment(counter.count());
} else if (metric instanceof Meter) {
Meter meter = (Meter) metric;
context.getCounter(COUNTER_GROUP, counterName).increment(meter.count());
} else if (metric instanceof Timer) {
Timer timer = (Timer) metric;
context.getCounter(COUNTER_GROUP, counterName).increment((long) timer.sum());
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!