From a99fc01707aeb00db7095374afc6b8da76b2451f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 4 Oct 2017 19:57:06 +0200 Subject: [PATCH] Store which threads access any given lock. --- server/TracyView.cpp | 12 +++++++----- server/TracyView.hpp | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index ca6fecfd..c77b494a 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -467,7 +467,7 @@ void View::ProcessLockAnnounce( const QueueLockAnnounce& ev ) { for( auto& v : it->second ) { - InsertLockEvent( lockmap.timeline, v ); + InsertLockEvent( lockmap, v ); } lock.unlock(); m_pendingLocks.erase( it ); @@ -490,7 +490,7 @@ void View::ProcessLockWait( const QueueLockWait& ev ) else { std::lock_guard lock( m_lock ); - InsertLockEvent( it->second.timeline, lev ); + InsertLockEvent( it->second, lev ); } } @@ -510,7 +510,7 @@ void View::ProcessLockObtain( const QueueLockObtain& ev ) else { std::lock_guard lock( m_lock ); - InsertLockEvent( it->second.timeline, lev ); + InsertLockEvent( it->second, lev ); } } @@ -530,7 +530,7 @@ void View::ProcessLockRelease( const QueueLockRelease& ev ) else { std::lock_guard lock( m_lock ); - InsertLockEvent( it->second.timeline, lev ); + InsertLockEvent( it->second, lev ); } } @@ -676,8 +676,10 @@ void View::InsertZone( Event* zone, Event* parent, Vector& vec ) } } -void View::InsertLockEvent( Vector& timeline, LockEvent* lev ) +void View::InsertLockEvent( LockMap& lockmap, LockEvent* lev ) { + lockmap.threads.insert( lev->thread ); + auto& timeline = lockmap.timeline; if( timeline.empty() || timeline.back()->time < lev->time ) { timeline.push_back( lev ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 2009a921..0460e846 100755 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -49,6 +49,7 @@ private: uint64_t id; uint64_t srcloc; Vector timeline; + std::unordered_set threads; }; void Worker(); @@ -84,7 +85,7 @@ private: void InsertZone( Event* zone, Event* parent, Vector& vec ); - void InsertLockEvent( Vector& timeline, LockEvent* lev ); + void InsertLockEvent( LockMap& lockmap, LockEvent* lev ); void UpdateLockCount( Vector& timeline, size_t pos ); uint64_t GetFrameTime( size_t idx ) const;