Ejemplo n.º 1
0
        /// <inheritdoc />
        public TimerValue GetValue(bool resetMetric = false)
        {
            var total = resetMetric ? _totalRecordedTime.GetAndReset() : _totalRecordedTime.GetValue();

            return(new TimerValue(_meter.GetValue(resetMetric), _histogram.GetValue(resetMetric), _activeSessionsCounter.GetValue(), total,
                                  TimeUnit.Nanoseconds));
        }
Ejemplo n.º 2
0
        private CounterValue GetValueWithSetItems()
        {
            Debug.Assert(_setCounters != null, "set counters not null");

            var total = _counter.GetValue();

            var items = new CounterValue.SetItem[_setCounters.Count];
            var index = 0;

            foreach (var item in _setCounters)
            {
                var itemValue = item.Value.GetValue();

                double percent    = total > 0 ? itemValue / (double)total * 100 : 0.0;
                var    setCounter = new CounterValue.SetItem(item.Key, itemValue, percent);
                items[index++] = setCounter;
                if (index == items.Length)
                {
                    break;
                }
            }

            Array.Sort(items, CounterValue.SetItemComparer);

            return(new CounterValue(total, items));
        }
Ejemplo n.º 3
0
 /// <inheritdoc />
 public TimerValue GetValue(bool resetMetric = false)
 {
     return(new TimerValue(
                _meter.GetValue(resetMetric),
                _histogram.GetValue(resetMetric),
                _activeSessionsCounter.GetValue(),
                TimeUnit.Nanoseconds));
 }
Ejemplo n.º 4
0
 /// <inheritdoc />
 public BucketTimerValue GetValue(bool resetMetric = false)
 {
     return(new BucketTimerValue(
                _meter.GetValue(resetMetric),
                _histogram.GetValue(resetMetric),
                _activeSessionsCounter.GetValue(),
                _timeUnit));
 }
Ejemplo n.º 5
0
        /// <inheritdoc />
        public TimerValue GetValue(bool resetMetric = false)
        {
            var activeSessions = resetMetric
                ? _activeSessionsCounter.GetAndReset()
                : _activeSessionsCounter.GetValue();

            return(new TimerValue(
                       _meter.GetValue(resetMetric),
                       _histogram.GetValue(resetMetric),
                       activeSessions,
                       TimeUnit.Nanoseconds));
        }
Ejemplo n.º 6
0
 public void Get()
 {
     // ReSharper disable UnusedVariable
     var x = _num.GetValue();
     // ReSharper restore UnusedVariable
 }
Ejemplo n.º 7
0
        /// <inheritdoc />
        public MeterValue GetValue(double elapsed)
        {
            var count = _total.GetValue() + _uncounted.GetValue();

            return(new MeterValue(count, GetMeanRate(count, elapsed), OneMinuteRate, FiveMinuteRate, FifteenMinuteRate, TimeUnit.Seconds));
        }
Ejemplo n.º 8
0
 public void Can_add_value()
 {
     _num.Add(7L);
     _num.GetValue().Should().Be(7L);
 }
Ejemplo n.º 9
0
 internal bool IsUsed()
 {
     return(usageCounter.GetValue() > 0);
 }
Ejemplo n.º 10
0
 public override long getTotalCount()
 {
     return(totalCount.GetValue());
 }
 public void Get()
 {
     var x = _num.GetValue();
 }