当前位置: 首页>>代码示例>>Java>>正文


Java Timer.getSnapshot方法代码示例

本文整理汇总了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);
}
 
开发者ID:staslev,项目名称:storm-metrics-reporter,代码行数:19,代码来源:YammerFacadeMetric.java

示例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());
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:21,代码来源:MemoryReporter.java

示例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());
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:21,代码来源:JSONReporter.java

示例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());
}
 
开发者ID:jasper-zhang,项目名称:kafka-influxdb,代码行数:31,代码来源:InfluxDBReporter.java

示例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);
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:28,代码来源:CustomReporter.java

示例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);
}
 
开发者ID:philipgloyne,项目名称:metrics-dashboard,代码行数:29,代码来源:HtmlReporter.java


注:本文中的com.yammer.metrics.core.Timer.getSnapshot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。