本文整理了Java中com.netflix.spectator.api.Clock.wallTime()
方法的一些代码示例,展示了Clock.wallTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clock.wallTime()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Clock
类名称:Clock
方法名:wallTime
[英]Current wall time in milliseconds since the epoch. Typically equivalent to System.currentTimeMillis.
[中]自历元以来的当前墙时间(毫秒)。通常相当于系统。当前时间毫秒。
代码示例来源:origin: apache/servicecomb-java-chassis
public PolledEvent poll(long secondInterval) {
long msNow = clock.wallTime();
List<Meter> meters = new ArrayList<>();
List<Measurement> measurements = new ArrayList<>();
for (Registry registry : registries) {
SpectatorUtils.removeExpiredMeters(registry);
for (Meter meter : registry) {
if (meter instanceof PeriodMeter) {
((PeriodMeter) meter).calcMeasurements(msNow, secondInterval);
}
meters.add(meter);
meter.measure().forEach(measurements::add);
}
}
return new PolledEvent(meters, measurements);
}
}
代码示例来源:origin: Netflix/spectator
/** Create a new instance. */
AtlasMeter(Id id, Clock clock, long ttl) {
this.id = id;
this.clock = clock;
this.ttl = ttl;
lastUpdated = clock.wallTime();
}
代码示例来源:origin: apache/servicecomb-java-chassis
public void onInvocationFinish(InvocationFinishEvent event) {
lastUpdated = registry.clock().wallTime();
InvocationStageTrace stageTrace = event.getInvocation().getInvocationStageTrace();
totalTimer.record((long) stageTrace.calcTotalTime());
handlersRequestTimer.record((long) stageTrace.calcHandlersRequestTime());
handlersResponseTimer.record((long) stageTrace.calcHandlersResponseTime());
prepareTimer.record((long) stageTrace.calcInvocationPrepareTime());
}
代码示例来源:origin: Netflix/spectator
/** Create a new instance. */
public StepLong(long init, Clock clock, long step) {
this.init = init;
this.clock = clock;
this.step = step;
previous = init;
current = new AtomicLong(init);
lastInitPos = new AtomicLong(clock.wallTime() / step);
}
代码示例来源:origin: Netflix/spectator
/** Get the AtomicLong for the current bucket. */
public AtomicLong getCurrent() {
rollCount(clock.wallTime());
return current;
}
代码示例来源:origin: Netflix/spectator
/** Get the value for the last completed interval. */
public long poll() {
rollCount(clock.wallTime());
return previous;
}
代码示例来源:origin: Netflix/spectator
MostFrequentLimiter(int n, Clock clock) {
this.n = n;
this.clock = clock;
this.limiter = first(n);
this.limiterTimestamp = clock.wallTime();
this.cutoff = 0L;
this.updatesWithHighChurn = 0;
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
final double delta = count.getAndSet(0.0);
if (delta > 0.0) {
final Measurement m = new Measurement(stat, clock.wallTime(), delta);
return Collections.singletonList(m);
} else {
return Collections.emptyList();
}
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
final double delta = value.getAndSet(0.0);
if (delta > 0.0) {
final Measurement m = new Measurement(stat, clock.wallTime(), delta);
return Collections.singletonList(m);
} else {
return Collections.emptyList();
}
}
}
代码示例来源:origin: Netflix/spectator
/**
* Create a new monitor that returns {@code value}.
*/
ServoMaxGauge(Id id, Clock clock, MonitorConfig config) {
super(config.withAdditionalTag(DataSourceType.GAUGE));
this.id = id;
this.clock = clock;
this.impl = new MaxGauge(config);
this.lastUpdated = new AtomicLong(clock.wallTime());
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
long now = clock.wallTime();
double v = count.get();
return Collections.singleton(new Measurement(id, now, v));
}
代码示例来源:origin: Netflix/spectator
/**
* Create a new monitor that returns {@code value}.
*/
ServoGauge(Id id, Clock clock, MonitorConfig config) {
super(config.withAdditionalTag(DataSourceType.GAUGE));
this.id = id;
this.clock = clock;
this.value = new AtomicDouble(Double.NaN);
this.lastUpdated = new AtomicLong(clock.wallTime());
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
long now = clock.wallTime();
long v = impl.getCount();
return Collections.singleton(new Measurement(id, now, v));
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
final long now = clock.wallTime();
final List<Measurement> ms = new ArrayList<>(2);
ms.add(new Measurement(id.withTag(Statistic.count), now, count.get()));
ms.add(new Measurement(id.withTag(Statistic.totalAmount), now, totalAmount.get()));
return ms;
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
long now = clock.wallTime();
double v = impl.getValue(0).doubleValue();
return Collections.singleton(new Measurement(id(), now, v));
}
代码示例来源:origin: Netflix/spectator
@Override public void record(long amount) {
if (amount >= 0) {
totalAmount.addAndGet(amount);
count.incrementAndGet();
servoTotal.increment(amount);
servoTotalOfSquares.increment(amount * amount);
servoCount.increment();
servoMax.update(amount);
lastUpdated.set(clock.wallTime());
}
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
final long now = clock.wallTime();
final Snapshot snapshot = impl.getSnapshot();
return Collections.singleton(new Measurement(id, now, snapshot.getMean()));
}
代码示例来源:origin: Netflix/spectator
@Override
public double apply(double v) {
return (r.clock().wallTime() - v) / 1000.0;
}
};
代码示例来源:origin: Netflix/metacat
void recordTime(final SNSMessage<?> message, final String timeName) {
final Timer timer = this.registry.timer(
timeName,
Metrics.TagEventsType.getMetricName(),
message.getClass().getName()
);
timer.record(this.registry.clock().wallTime() - message.getTimestamp(), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
final List<Measurement> ms = new ArrayList<>(2);
final long now = clock.wallTime();
final double durationSeconds = duration() / NANOS_PER_SECOND;
ms.add(new Measurement(id.withTag(Statistic.duration), now, durationSeconds));
ms.add(new Measurement(id.withTag(Statistic.activeTasks), now, activeTasks()));
return ms;
}
}
内容来源于网络,如有侵权,请联系作者删除!