作者:115路公交车_984 | 来源:互联网 | 2023-09-15 13:09
本文整理了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();
}