com.yammer.metrics.core.Timer.clear()方法的使用及代码示例

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

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

Timer.clear介绍

[英]Clears all recorded durations.
[中]清除所有记录的持续时间。

代码示例

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

/**
 * Creates a new {@link Timer}.
 *
 * @param tickThread   background thread for updating the rates
 * @param durationUnit the scale unit for this timer's duration metrics
 * @param rateUnit     the scale unit for this timer's rate metrics
 * @param clock        the clock used to calculate duration
 */
Timer(ScheduledExecutorService tickThread, TimeUnit durationUnit, TimeUnit rateUnit, Clock clock) {
  this.durationUnit = durationUnit;
  this.rateUnit = rateUnit;
  this.meter = new Meter(tickThread, "calls", rateUnit, clock);
  this.clock = clock;
  clear();
}

代码示例来源:origin: com.wavefront/java-lib

@Override
 public void processTimer(MetricName name, Timer timer, Context context) throws Exception {
  final JsonGenerator json = context.json;
  json.writeStartObject();
  {
   json.writeFieldName("duration");
   json.writeStartObject();
   {
    json.writeStringField("unit", timer.durationUnit().toString().toLowerCase());
    writeSummarizable(timer, json);
    writeSampling(timer, json);
    if (context.showFullSamples) {
     json.writeObjectField("values", timer.getSnapshot().getValues());
    }
   }
   json.writeEndObject();
   json.writeFieldName("rate");
   json.writeStartObject();
   {
    writeMeteredFields(timer, json);
   }
   json.writeEndObject();
  }
  json.writeEndObject();
  if (clear) timer.clear();
 }
}

代码示例来源:origin: wavefrontHQ/java

@Override
 public void processTimer(MetricName name, Timer timer, Context context) throws Exception {
  final JsonGenerator json = context.json;
  json.writeStartObject();
  {
   json.writeFieldName("duration");
   json.writeStartObject();
   {
    json.writeStringField("unit", timer.durationUnit().toString().toLowerCase());
    writeSummarizable(timer, json);
    writeSampling(timer, json);
    if (context.showFullSamples) {
     json.writeObjectField("values", timer.getSnapshot().getValues());
    }
   }
   json.writeEndObject();
   json.writeFieldName("rate");
   json.writeStartObject();
   {
    writeMeteredFields(timer, json);
   }
   json.writeEndObject();
  }
  json.writeEndObject();
  if (clear) timer.clear();
 }
}

代码示例来源:origin: wavefrontHQ/java

@Override
public void processTimer(MetricName name, Timer timer, Void context) throws Exception {
 MetricName samplingName, rateName;
 if (name instanceof TaggedMetricName) {
  TaggedMetricName taggedMetricName = (TaggedMetricName) name;
  samplingName = new TaggedMetricName(
    taggedMetricName.getGroup(), taggedMetricName.getName() + ".duration", taggedMetricName.getTags());
  rateName = new TaggedMetricName(
    taggedMetricName.getGroup(), taggedMetricName.getName() + ".rate", taggedMetricName.getTags());
 } else {
  samplingName = new MetricName(name.getGroup(), name.getType(), name.getName() + ".duration");
  rateName = new MetricName(name.getGroup(), name.getType(), name.getName() + ".rate");
 }
 writeSummarizable(samplingName, timer);
 writeSampling(samplingName, timer);
 writeMetered(rateName, timer);
 if (clear) timer.clear();
}

相关文章