예제 #1
0
 public Counter()
 {
     _count = new AtomicLong(0);
 }
예제 #2
0
 /// <summary>
 /// Creates a new cached gauge with the given clock and timeout period.
 /// </summary>
 /// <param name="clock">the clock used to calculate the timeout</param>
 /// <param name="timeout">the timeout</param>
 /// <param name="timeoutUnit">the unit of timeout</param>
 /// <param name="evaluator">Method of loading the value</param>
 public CachedGauge(Clock clock, long timeout, TimeUnit timeoutUnit, Func <T> evaluator) : base(evaluator)
 {
     this.clock     = clock;
     this.reloadAt  = new AtomicLong(0);
     this.timeoutNS = timeoutUnit.ToNanos(timeout);
 }
예제 #3
0
 /// <summary>
 /// Creates a new <see cref="Histogram" /> with the given sample type
 /// </summary>
 /// <param name="reservoir">the reservoir to create a histogram from</param>
 public Histogram(Reservoir reservoir)
 {
     this.reservoir = reservoir;
     this.count     = new AtomicLong(0);
 }
예제 #4
0
 /// <summary>
 /// Creates a new <see cref="Meter"/>
 /// </summary>
 /// <param name="clock">the clock to use for the meter ticks</param>
 public Meter(Clock clock)
 {
     this.clock      = clock;
     this._startTime = this.clock.getTick();
     this._lastTick  = new AtomicLong(_startTime);
 }