1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Store pending lock events, if lock was not yet announced.

This commit is contained in:
Bartosz Taudul 2017-10-04 18:32:22 +02:00
parent 06a08816bd
commit 110e5971d1
2 changed files with 40 additions and 0 deletions

View File

@ -377,10 +377,13 @@ void View::Process( const QueueItem& ev )
ProcessLockAnnounce( ev.lockAnnounce ); ProcessLockAnnounce( ev.lockAnnounce );
break; break;
case QueueType::LockWait: case QueueType::LockWait:
ProcessLockWait( ev.lockWait );
break; break;
case QueueType::LockObtain: case QueueType::LockObtain:
ProcessLockObtain( ev.lockObtain );
break; break;
case QueueType::LockRelease: case QueueType::LockRelease:
ProcessLockRelease( ev.lockRelease );
break; break;
default: default:
assert( false ); assert( false );
@ -459,6 +462,39 @@ void View::ProcessLockAnnounce( const QueueLockAnnounce& ev )
m_lockMap.emplace( ev.id, LockMap { ev.srcloc } ); m_lockMap.emplace( ev.id, LockMap { ev.srcloc } );
} }
void View::ProcessLockWait( const QueueLockWait& ev )
{
auto it = m_lockMap.find( ev.id );
if( it == m_lockMap.end() )
{
auto& v = m_pendingLocks[ev.id];
v.push_back( LockEvent { ev.time, ev.thread, LockEvent::Type::Wait } );
return;
}
}
void View::ProcessLockObtain( const QueueLockObtain& ev )
{
auto it = m_lockMap.find( ev.id );
if( it == m_lockMap.end() )
{
auto& v = m_pendingLocks[ev.id];
v.push_back( LockEvent { ev.time, ev.thread, LockEvent::Type::Obtain } );
return;
}
}
void View::ProcessLockRelease( const QueueLockRelease& ev )
{
auto it = m_lockMap.find( ev.id );
if( it == m_lockMap.end() )
{
auto& v = m_pendingLocks[ev.id];
v.push_back( LockEvent { ev.time, ev.thread, LockEvent::Type::Release } );
return;
}
}
void View::CheckString( uint64_t ptr ) void View::CheckString( uint64_t ptr )
{ {
if( m_strings.find( ptr ) != m_strings.end() ) return; if( m_strings.find( ptr ) != m_strings.end() ) return;

View File

@ -64,6 +64,9 @@ private:
void ProcessZoneText( const QueueZoneText& ev ); void ProcessZoneText( const QueueZoneText& ev );
void ProcessZoneName( const QueueZoneName& ev ); void ProcessZoneName( const QueueZoneName& ev );
void ProcessLockAnnounce( const QueueLockAnnounce& ev ); void ProcessLockAnnounce( const QueueLockAnnounce& ev );
void ProcessLockWait( const QueueLockWait& ev );
void ProcessLockObtain( const QueueLockObtain& ev );
void ProcessLockRelease( const QueueLockRelease& ev );
void CheckString( uint64_t ptr ); void CheckString( uint64_t ptr );
void CheckThreadString( uint64_t id ); void CheckThreadString( uint64_t id );
@ -140,6 +143,7 @@ private:
std::unordered_set<uint64_t> m_pendingSourceLocation; std::unordered_set<uint64_t> m_pendingSourceLocation;
std::unordered_map<uint64_t, Event*> m_pendingCustomStrings; std::unordered_map<uint64_t, Event*> m_pendingCustomStrings;
std::unordered_map<uint64_t, uint32_t> m_threadMap; std::unordered_map<uint64_t, uint32_t> m_threadMap;
std::unordered_map<uint64_t, std::vector<LockEvent>> m_pendingLocks;
Slab<EventSize*1024*1024> m_slab; Slab<EventSize*1024*1024> m_slab;