From a662474c24b228f70429d36963b7730d1be98722 Mon Sep 17 00:00:00 2001 From: Brian Robbins Date: Tue, 28 May 2024 04:39:56 -0700 Subject: [PATCH] Fix the Contention Stacks view for .NET Framework and older .NET Core (#2038) processes. This change will use the time difference between the Contention/Start and Contention/Stop event unless the process is running on a newer version of .NET Core that specifies the time difference in the Contention/Stop event. This is the ensure that this view works for all .NET processes and not just newer .NET Core processes. --- src/TraceEvent/Computers/StartStopLatencyComputer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TraceEvent/Computers/StartStopLatencyComputer.cs b/src/TraceEvent/Computers/StartStopLatencyComputer.cs index 2e9987876..5e0917c83 100644 --- a/src/TraceEvent/Computers/StartStopLatencyComputer.cs +++ b/src/TraceEvent/Computers/StartStopLatencyComputer.cs @@ -38,7 +38,10 @@ protected override void RecordAdditionalDataOnStartWithoutStop(StackSourceSample protected override void RecordAdditionalStopData(StackSourceSample sample, TraceEvent data) { var stopData = (ContentionStopTraceData) data; - sample.Metric = (float) (stopData.DurationNs / NanosInMillisecond); + if (stopData.DurationNs > 0) + { + sample.Metric = (float)(stopData.DurationNs / NanosInMillisecond); + } sample.StackIndex = _interner.CallStackIntern(_interner.FrameIntern($"EventData DurationNs {stopData.DurationNs:N0}"), sample.StackIndex); } }