diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index b09321d7..5f43e658 100755 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -42,6 +42,7 @@ struct LockEvent int64_t time; uint64_t thread; uint8_t lockCount; + uint8_t waitCount; Type type; }; diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 40d2d299..6312b447 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -719,25 +719,33 @@ void View::InsertLockEvent( LockMap& lockmap, LockEvent* lev ) void View::UpdateLockCount( Vector& timeline, size_t pos ) { - uint8_t count = pos == 0 ? 0 : timeline[pos-1]->lockCount; + uint8_t lockCount = pos == 0 ? 0 : timeline[pos-1]->lockCount; + uint8_t waitCount = pos == 0 ? 0 : timeline[pos-1]->waitCount; const auto end = timeline.size(); while( pos != end ) { switch( timeline[pos]->type ) { + case LockEvent::Type::Wait: + assert( waitCount < std::numeric_limits::max() ); + waitCount++; + break; case LockEvent::Type::Obtain: - assert( count < std::numeric_limits::max() ); - count++; + assert( lockCount < std::numeric_limits::max() ); + assert( waitCount > 0 ); + lockCount++; + waitCount--; break; case LockEvent::Type::Release: - assert( count > 0 ); - count--; + assert( lockCount > 0 ); + lockCount--; break; default: break; } - timeline[pos]->lockCount = count; + timeline[pos]->lockCount = lockCount; + timeline[pos]->waitCount = waitCount; pos++; } }