From 788d9b77fcd99b828282213c3b18aac4b1d6b042 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 15 Apr 2023 22:26:22 +0200 Subject: [PATCH] Use proper start time to determine if break combining locks. Without this correction the code would combine all lock regions according to the minimum visibility range rules, and assign the combined area the highest lock state within all items. This could produce quote long combined lock regions, where apparently lock contention happened. Combined lock regions should instead be split to show exactly where the lock contention is present. Combining is still performed here, but only within the minimum visibility range. This new behavior was also present previously, but was mistakenly omitted during code refactor. --- server/TracyTimelineItemThread.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/TracyTimelineItemThread.cpp b/server/TracyTimelineItemThread.cpp index 68a0690f..8f89f414 100644 --- a/server/TracyTimelineItemThread.cpp +++ b/server/TracyTimelineItemThread.cpp @@ -970,7 +970,8 @@ void TimelineItemThread::PreprocessLocks( const TimelineContext& ctx, const unor LockState::Type drawState = state; auto next = GetNextLockFunc( vbegin, vend, state, threadBit ); - auto t0 = vbegin->ptr->Time(); + const auto tStart = vbegin->ptr->Time(); + int64_t t0 = tStart; int64_t t1 = next == tl.end() ? m_worker.GetLastTime() : next->ptr->Time(); uint32_t condensed = 0; @@ -992,7 +993,7 @@ void TimelineItemThread::PreprocessLocks( const TimelineContext& ctx, const unor condensed++; const auto t2 = n == tl.end() ? m_worker.GetLastTime() : n->ptr->Time(); if( t2 - t1 > MinVisNs ) break; - if( drawState != ns && t2 - t0 > MinVisNs && ( ns & mask ) == 0 ) break; + if( drawState != ns && t2 - tStart > MinVisNs && ( ns & mask ) == 0 ) break; t0 = t1; t1 = t2; next = n;