本文整理匯總了Java中com.yammer.metrics.core.Timer.getSnapshot方法的典型用法代碼示例。如果您正苦於以下問題:Java Timer.getSnapshot方法的具體用法?Java Timer.getSnapshot怎麽用?Java Timer.getSnapshot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.yammer.metrics.core.Timer
的用法示例。
在下文中一共展示了Timer.getSnapshot方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processTimer
import com.yammer.metrics.core.Timer; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void processTimer(final MetricName name, final Timer timer, final Map context) throws Exception {
final Snapshot snapshot = timer.getSnapshot();
final Map subMetrics =
ImmutableMap
.builder()
.put("count", timer.count())
.put("median", snapshot.getMedian())
.put("75percentile", snapshot.get75thPercentile())
.put("95percentile", snapshot.get95thPercentile())
.put("99percentile", snapshot.get99thPercentile())
.build();
context.put(toString(name), subMetrics);
}
示例2: processTimer
import com.yammer.metrics.core.Timer; //導入方法依賴的package包/類
@Override
public void processTimer(MetricName name, Timer timer,
ConcurrentMap<String, org.apache.blur.thrift.generated.Metric> context) throws Exception {
org.apache.blur.thrift.generated.Metric metric = getMetric(name, context);
addMeter(metric, timer, context);
metric.putToStrMap("unit", timer.durationUnit().toString());
metric.putToDoubleMap("min", timer.min());
metric.putToDoubleMap("max", timer.max());
metric.putToDoubleMap("mean", timer.mean());
metric.putToDoubleMap("stdDev", timer.stdDev());
Snapshot snapshot = timer.getSnapshot();
metric.putToDoubleMap("median", snapshot.getMedian());
metric.putToDoubleMap("75%", snapshot.get75thPercentile());
metric.putToDoubleMap("95%", snapshot.get95thPercentile());
metric.putToDoubleMap("98%", snapshot.get98thPercentile());
metric.putToDoubleMap("99%", snapshot.get99thPercentile());
metric.putToDoubleMap("99.9%", snapshot.get999thPercentile());
}
示例3: processTimer
import com.yammer.metrics.core.Timer; //導入方法依賴的package包/類
@Override
public void processTimer(MetricName name, Timer timer, Context context) throws Exception {
MetricInfo info = context.getMetricInfo(name);
long time = context.getTime();
addMeterInfo(time, timer, info);
info.setMetaData("unit", timer.durationUnit().toString());
info.addNumber("min", timer.min());
info.addNumber("max", timer.max());
info.addNumber("mean", timer.mean());
info.addNumber("stdDev", timer.stdDev());
Snapshot snapshot = timer.getSnapshot();
info.addNumber("median", snapshot.getMedian());
info.addNumber("75%", snapshot.get75thPercentile());
info.addNumber("95%", snapshot.get95thPercentile());
info.addNumber("98%", snapshot.get98thPercentile());
info.addNumber("99%", snapshot.get99thPercentile());
info.addNumber("99.9%", snapshot.get999thPercentile());
}
示例4: processTimer
import com.yammer.metrics.core.Timer; //導入方法依賴的package包/類
public void processTimer(MetricName metricName, Timer timer, Context context) throws Exception {
final Snapshot snapshot = timer.getSnapshot();
Point.Builder pointbuilder = buildMetricsPointByMetricName(metricName, context);
pointbuilder.tag("metric_type", "timer");
pointbuilder.addField("count", timer.count());
pointbuilder.addField("meanRate", timer.meanRate());
pointbuilder.addField("1MinuteRate", timer.oneMinuteRate());
pointbuilder.addField("5MinuteRate", timer.fiveMinuteRate());
pointbuilder.addField("15MinuteRate", timer.fifteenMinuteRate());
pointbuilder.addField("max", timer.max());
pointbuilder.addField("mean", timer.mean());
pointbuilder.addField("min", timer.min());
pointbuilder.addField("stddev", timer.max());
pointbuilder.addField("sum", timer.sum());
pointbuilder.addField("median", snapshot.getMedian());
pointbuilder.addField("p75", snapshot.get75thPercentile());
pointbuilder.addField("p95", snapshot.get95thPercentile());
pointbuilder.addField("p98", snapshot.get98thPercentile());
pointbuilder.addField("p99", snapshot.get99thPercentile());
pointbuilder.addField("p999", snapshot.get999thPercentile());
addPoint(pointbuilder.build());
}
示例5: processTimer
import com.yammer.metrics.core.Timer; //導入方法依賴的package包/類
@Override
public void processTimer(final MetricName name, final Timer timer,
final PrintStream stream) {
processMeter(name, timer, stream);
final String durationUnit = abbrev(timer.durationUnit());
final Snapshot snapshot = timer.getSnapshot();
stream.printf(locale, " min = %,2.2f %s\n", timer.min(),
durationUnit);
stream.printf(locale, " max = %,2.2f %s\n", timer.max(),
durationUnit);
stream.printf(locale, " mean = %,2.2f %s\n", timer.mean(),
durationUnit);
stream.printf(locale, " stddev = %,2.2f %s\n",
timer.stdDev(), durationUnit);
stream.printf(locale, " median = %,2.2f %s\n",
snapshot.getMedian(), durationUnit);
stream.printf(locale, " 75%% <= %,2.2f %s\n",
snapshot.get75thPercentile(), durationUnit);
stream.printf(locale, " 95%% <= %,2.2f %s\n",
snapshot.get95thPercentile(), durationUnit);
stream.printf(locale, " 98%% <= %,2.2f %s\n",
snapshot.get98thPercentile(), durationUnit);
stream.printf(locale, " 99%% <= %,2.2f %s\n",
snapshot.get99thPercentile(), durationUnit);
stream.printf(locale, " 99.9%% <= %,2.2f %s\n",
snapshot.get999thPercentile(), durationUnit);
}
示例6: processTimer
import com.yammer.metrics.core.Timer; //導入方法依賴的package包/類
public void processTimer(MetricName name, Timer timer, PrintStream stream) {
stream.append(TABLE_BEGIN);
header(name.getName(), stream);
meterRows(timer, stream);
String durationUnit = abbrev(timer.durationUnit());
final Snapshot snapshot = timer.getSnapshot();
stream.printf("<tr><td>min</td><td>%2.2f %s</td></tr>", timer.min(), durationUnit);
stream.printf("<tr><td>max</td><td>%2.2f %s</td></tr>", timer.max(), durationUnit);
stream.printf("<tr><td>mean</td><td>%2.2f %s</td></tr>", timer.mean(), durationUnit);
stream.printf("<tr><td>stddev</td><td>%2.2f %s</td></tr>", timer.stdDev(), durationUnit);
snapShotRows(snapshot, stream);
stream.append(TABLE_END);
GraphData<Timer> graphData = GraphData.timerGraphData(name, maxItems);
graphData.addItem(timer);
stream.append("<div class=\"span8 chart\"");
stream.printf(" id=\"chart-%s\"", name.hashCode());
stream.append(" style=\"height:420px;width:620px;\"");
stream.printf(" data=\"%s\"", graphData.data());
stream.append(" name=\"time\" labels=\"['median', 'max', 'min']\"" );
stream.append("></div>");
meterGraph(name, timer, stream);
}