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 );
break;
case QueueType::LockWait:
ProcessLockWait( ev.lockWait );
break;
case QueueType::LockObtain:
ProcessLockObtain( ev.lockObtain );
break;
case QueueType::LockRelease:
ProcessLockRelease( ev.lockRelease );
break;
default:
assert( false );
@ -459,6 +462,39 @@ void View::ProcessLockAnnounce( const QueueLockAnnounce& ev )
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 )
{
if( m_strings.find( ptr ) != m_strings.end() ) return;

View File

@ -64,6 +64,9 @@ private:
void ProcessZoneText( const QueueZoneText& ev );
void ProcessZoneName( const QueueZoneName& 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 CheckThreadString( uint64_t id );
@ -140,6 +143,7 @@ private:
std::unordered_set<uint64_t> m_pendingSourceLocation;
std::unordered_map<uint64_t, Event*> m_pendingCustomStrings;
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;