Esempio 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));
        }
Esempio 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));
        }
Esempio n. 3
0
 /// <inheritdoc />
 public TimerValue GetValue(bool resetMetric = false)
 {
     return(new TimerValue(
                _meter.GetValue(resetMetric),
                _histogram.GetValue(resetMetric),
                _activeSessionsCounter.GetValue(),
                TimeUnit.Nanoseconds));
 }
Esempio n. 4
0
 /// <inheritdoc />
 public BucketTimerValue GetValue(bool resetMetric = false)
 {
     return(new BucketTimerValue(
                _meter.GetValue(resetMetric),
                _histogram.GetValue(resetMetric),
                _activeSessionsCounter.GetValue(),
                _timeUnit));
 }
        /// <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));
        }
Esempio n. 6
0
 public void Get()
 {
     // ReSharper disable UnusedVariable
     var x = _num.GetValue();
     // ReSharper restore UnusedVariable
 }
Esempio 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));
        }
 public void Can_add_value()
 {
     _num.Add(7L);
     _num.GetValue().Should().Be(7L);
 }
Esempio n. 9
0
 internal bool IsUsed()
 {
     return(usageCounter.GetValue() > 0);
 }
Esempio n. 10
0
 public override long getTotalCount()
 {
     return(totalCount.GetValue());
 }
 public void Get()
 {
     var x = _num.GetValue();
 }