本文整理汇总了Java中com.codahale.metrics.Clock.getTick方法的典型用法代码示例。如果您正苦于以下问题:Java Clock.getTick方法的具体用法?Java Clock.getTick怎么用?Java Clock.getTick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codahale.metrics.Clock
的用法示例。
在下文中一共展示了Clock.getTick方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CustomMeter
import com.codahale.metrics.Clock; //导入方法依赖的package包/类
public CustomMeter(final Clock clock, final int periodSec) {
final double ps = periodSec > 0 ? periodSec : 10;
final int intervalSecs = 1;
rateAvg = new EWMA(1 - exp(-intervalSecs / ps), intervalSecs, TimeUnit.SECONDS);
this.clock = clock;
startTime = clock.getTick();
lastTick.set(startTime);
}
示例2: ExponentialLeakyBucket
import com.codahale.metrics.Clock; //导入方法依赖的package包/类
/**
* Creates a new {@link ExponentialLeakyBucket}.
*
* @param size the number of samples to keep in the sampling reservoir
* @param alpha the exponential decay factor; the higher this is, the more biased the reservoir
* will be towards newer values
* @param clock the clock to use
*/
public ExponentialLeakyBucket(int size, double alpha, Clock clock) {
this.values = new ConcurrentSkipListMap<Double, T>();
this.lock = new ReentrantReadWriteLock();
this.alpha = alpha;
this.size = size;
this.clock = clock;
this.count = new AtomicLong(0);
this.startTime = currentTimeInSeconds();
this.nextScaleTime = new AtomicLong(clock.getTick() + RESCALE_THRESHOLD);
}
示例3: OperationContext
import com.codahale.metrics.Clock; //导入方法依赖的package包/类
public OperationContext(OperationId id, Clock clock) {
this.id = id;
this.startTime = clock.getTick();
}