/// <summary>
        ///         /// Creates a new ExponentiallyDecayingReservoir
        /// </summary>
        /// <param name="size">The number of samples to keep in the sampling reservoir</param>
        /// <param name="alpha">The exponential decay factor; the higher this is, the more biased the sample will be towards newer values</param>
        /// <param name="clock">the clock used to timestamp samples and track rescaling</param>
        public ExponentiallyDecayingReservoir(int size, double alpha, Clock clock)
        {
            _values = new ConcurrentDictionary<double, WeightedSample>();
            _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
            _alpha = alpha;
            _size = size;
            this.clock = clock;
            this._count = new AtomicLong(0);
            this._startTime = CurrentTimeInSeconds();
            this._nextScaleTime = new AtomicLong(clock.getTick() + RESCALE_THRESHOLD);

        }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 public Counter()
 {
      _count = new AtomicLong(0);
 }
Exemplo n.º 4
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);
 }