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.
This commit is contained in:
Bartosz Taudul 2023-04-15 22:26:22 +02:00
parent e68214a88a
commit 788d9b77fc
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -970,7 +970,8 @@ void TimelineItemThread::PreprocessLocks( const TimelineContext& ctx, const unor
LockState::Type drawState = state; LockState::Type drawState = state;
auto next = GetNextLockFunc( vbegin, vend, state, threadBit ); 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(); int64_t t1 = next == tl.end() ? m_worker.GetLastTime() : next->ptr->Time();
uint32_t condensed = 0; uint32_t condensed = 0;
@ -992,7 +993,7 @@ void TimelineItemThread::PreprocessLocks( const TimelineContext& ctx, const unor
condensed++; condensed++;
const auto t2 = n == tl.end() ? m_worker.GetLastTime() : n->ptr->Time(); const auto t2 = n == tl.end() ? m_worker.GetLastTime() : n->ptr->Time();
if( t2 - t1 > MinVisNs ) break; 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; t0 = t1;
t1 = t2; t1 = t2;
next = n; next = n;