Пример #1
0
 public void ProcessEvent(EventWrittenEventArgs e)
 {
     if (_eventPairTimer.TryGetEventPairDuration(e, out var duration))
     {
         ContentionTotal.Inc();
         ContentionSecondsTotal.Inc(duration.TotalSeconds);
     }
 }
 public void ProcessEvent(EventWrittenEventArgs e)
 {
     if (_eventPairTimer.TryGetDuration(e, out var duration) == DurationResult.FinalWithDuration)
     {
         ContentionTotal.Inc(_samplingRate.SampleEvery);
         ContentionSecondsTotal.Inc(duration.TotalSeconds * _samplingRate.SampleEvery);
     }
 }
        public void RegisterMetrics(MetricFactory metrics)
        {
            if (!_contentionInfo.Enabled && !_runtimeCounters.Enabled)
            {
                return;
            }

            ContentionTotal = metrics.CreateCounter("dotnet_contention_total", "The number of locks contended");
            _runtimeCounters.Events.MonitorLockContentionCount += e => ContentionTotal.Inc(e.IncrementedBy);

            if (_contentionInfo.Enabled)
            {
                ContentionSecondsTotal = metrics.CreateCounter("dotnet_contention_seconds_total", "The total amount of time spent contending locks");
                _contentionInfo.Events.ContentionEnd += e => ContentionSecondsTotal.Inc(e.ContentionDuration.TotalSeconds);
            }
        }
        public void ProcessEvent(EventWrittenEventArgs e)
        {
            switch (_eventPairTimer.TryGetDuration(e, out var duration))
            {
            case DurationResult.Start:
                ContentionTotal.Inc();
                return;

            case DurationResult.FinalWithDuration:
                ContentionSecondsTotal.Inc(duration.TotalSeconds * _samplingRate.SampleEvery);
                return;

            default:
                return;
            }
        }