本文整理了Java中com.netflix.spectator.api.Clock.monotonicTime()
方法的一些代码示例,展示了Clock.monotonicTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clock.monotonicTime()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Clock
类名称:Clock
方法名:monotonicTime
[英]Current time from a monotonic clock source. The value is only meaningful when compared with another snapshot to determine the elapsed time for an operation. The difference between two samples will have a unit of nanoseconds. The returned value is typically equivalent to System.nanoTime.
[中]来自单调时钟源的当前时间。该值仅在与另一个快照进行比较以确定操作的运行时间时才有意义。两个样本之间的差值以纳秒为单位。返回的值通常相当于系统。纳米时代。
代码示例来源:origin: spinnaker/kayenta
private List<InfluxDbResult> queryInfluxdb(InfluxDbRemoteService remoteService, String metricSetName, String query) {
long startTime = registry.clock().monotonicTime();
List<InfluxDbResult> influxDbResults;
try {
influxDbResults = remoteService.query(metricSetName, query);
} finally {
long endTime = registry.clock().monotonicTime();
Id influxDbFetchTimerId = registry.createId("influxdb.fetchTime");
registry.timer(influxDbFetchTimerId).record(endTime - startTime, TimeUnit.NANOSECONDS);
}
return influxDbResults;
}
代码示例来源:origin: spinnaker/kayenta
long startTime = registry.clock().monotonicTime();
List<PrometheusResults> prometheusResultsList;
canaryScope.getStep());
} finally {
long endTime = registry.clock().monotonicTime();
代码示例来源:origin: Netflix/spectator
@Override
public long monotonicTime() {
return impl.monotonicTime();
}
}
代码示例来源:origin: org.springframework.metrics/spring-metrics
@Override
public long monotonicTime() {
return impl.monotonicTime();
}
}
代码示例来源:origin: spinnaker/kayenta
long startTime = registry.clock().monotonicTime();
ListTimeSeriesResponse response;
response = list.execute();
} finally {
long endTime = registry.clock().monotonicTime();
Id stackdriverFetchTimerId = registry.createId("stackdriver.fetchTime").withTag("project", projectId);
代码示例来源:origin: spinnaker/kayenta
String isoStep = Duration.of(atlasCanaryScope.getStep(), SECONDS) + "";
long start = registry.clock().monotonicTime();
List <AtlasResults> atlasResultsList;
try {
MAX_RETRIES, RETRY_BACKOFF);
} finally {
long end = registry.clock().monotonicTime();
registry.timer("atlas.fetchTime").record(end - start, TimeUnit.NANOSECONDS);
代码示例来源:origin: Netflix/spectator
@Override public long start() {
long task = nextTask.getAndIncrement();
tasks.put(task, clock.monotonicTime());
return task;
}
代码示例来源:origin: Netflix/spectator
@Override public long stop(long task) {
Long startTime = tasks.get(task);
if (startTime != null) {
tasks.remove(task);
return clock.monotonicTime() - startTime;
} else {
return -1L;
}
}
代码示例来源:origin: Netflix/spectator
@Override public void record(Runnable f) {
final long start = clock.monotonicTime();
try {
f.run();
} finally {
record(clock.monotonicTime() - start, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: Netflix/spectator
@Override public void record(Runnable f) {
final long s = clock.monotonicTime();
try {
f.run();
} finally {
final long e = clock.monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
}
代码示例来源:origin: Netflix/spectator
@Override public <T> T record(Callable<T> f) throws Exception {
final long start = clock.monotonicTime();
try {
return f.call();
} finally {
record(clock.monotonicTime() - start, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: Netflix/spectator
@Override public <T> T record(Callable<T> f) throws Exception {
final long s = clock.monotonicTime();
try {
return f.call();
} finally {
final long e = clock.monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: Netflix/spectator
@Override public <T> T record(Callable<T> rf) throws Exception {
final Clock clock = registry.clock();
final long s = clock.monotonicTime();
try {
return rf.call();
} finally {
final long e = clock.monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: Netflix/spectator
@Override public void record(Runnable rf) {
final Clock clock = registry.clock();
final long s = clock.monotonicTime();
try {
rf.run();
} finally {
final long e = clock.monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: Netflix/spectator
@Override public void record(Runnable rf) {
final Clock clock = registry.clock();
final long s = clock.monotonicTime();
try {
rf.run();
} finally {
final long e = clock.monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override public <T> T record(Callable<T> rf) throws Exception {
final Clock clock = registry.clock();
final long s = clock.monotonicTime();
try {
return rf.call();
} finally {
final long e = clock.monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: Netflix/spectator
/**
* Record the latency for the request based on the completion time. This will be
* implicitly called when the request is logged, but it is advisable to call as soon
* as the response is received to minimize the amount of response processing that is
* counted as part of the request latency.
*/
public IpcLogEntry markEnd() {
return withLatency(clock.monotonicTime() - startNanos, TimeUnit.NANOSECONDS);
}
代码示例来源:origin: Netflix/spectator
@Override public <T> T record(Callable<T> rf) throws Exception {
final Clock clock = registry.clock();
final long s = clock.monotonicTime();
try {
return rf.call();
} finally {
final long e = clock.monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: Netflix/spectator
@Override public void record(Runnable f) {
final long s = registry.clock().monotonicTime();
try {
f.run();
} finally {
final long e = registry.clock().monotonicTime();
record(e - s, TimeUnit.NANOSECONDS);
}
}
代码示例来源:origin: com.netflix.kayenta/kayenta-influxdb
private List<InfluxDbResult> queryInfluxdb(InfluxDbRemoteService remoteService, String metricSetName, String query) {
long startTime = registry.clock().monotonicTime();
List<InfluxDbResult> influxDbResults;
try {
influxDbResults = remoteService.query(metricSetName, query);
} finally {
long endTime = registry.clock().monotonicTime();
Id influxDbFetchTimerId = registry.createId("influxdb.fetchTime");
registry.timer(influxDbFetchTimerId).record(endTime - startTime, TimeUnit.NANOSECONDS);
}
return influxDbResults;
}
内容来源于网络,如有侵权,请联系作者删除!