本文整理匯總了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();
}