Java 类com.codahale.metrics.EWMA 实例源码

项目:mongoose-base    文件:CustomMeter.java   
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);
}
项目:datacollector    文件:ExtendedMeter.java   
public ExtendedMeter(Clock clock) {
  super(clock);
  this.clock = clock;
  this.lastTick = new AtomicLong(this.clock.getTick());
  m30Rate = new EWMA(M30_ALPHA, INTERVAL, TimeUnit.SECONDS);
  h1Rate = new EWMA(H1_ALPHA, INTERVAL, TimeUnit.SECONDS);
  h6Rate = new EWMA(H6_ALPHA, INTERVAL, TimeUnit.SECONDS);
  h12Rate = new EWMA(H12_ALPHA, INTERVAL, TimeUnit.SECONDS);
  h24Rate = new EWMA(H24_ALPHA, INTERVAL, TimeUnit.SECONDS);
}