mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Announce lock creation.
This commit is contained in:
parent
069354b5dd
commit
78f8425dc7
@ -12,6 +12,13 @@ class Lockable
|
||||
public:
|
||||
Lockable( const SourceLocation* srcloc )
|
||||
{
|
||||
Magic magic;
|
||||
auto& token = s_token;
|
||||
auto item = s_queue.enqueue_begin( token, magic );
|
||||
item->hdr.type = QueueType::LockAnnounce;
|
||||
item->lockAnnounce.id = (uint64_t)&m_lockable;
|
||||
item->lockAnnounce.srcloc = (uint64_t)srcloc;
|
||||
s_queue.enqueue_finish( token, magic );
|
||||
}
|
||||
|
||||
Lockable( const Lockable& ) = delete;
|
||||
|
@ -27,6 +27,14 @@ struct Event
|
||||
|
||||
enum { EventSize = sizeof( Event ) };
|
||||
|
||||
|
||||
struct LockEvent
|
||||
{
|
||||
uint64_t srcloc;
|
||||
};
|
||||
|
||||
enum { LockEventSize = sizeof( LockEvent ) };
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -373,6 +373,9 @@ void View::Process( const QueueItem& ev )
|
||||
case QueueType::ZoneName:
|
||||
ProcessZoneName( ev.zoneName );
|
||||
break;
|
||||
case QueueType::LockAnnounce:
|
||||
ProcessLockAnnounce( ev.lockAnnounce );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
@ -441,6 +444,27 @@ void View::ProcessZoneName( const QueueZoneName& ev )
|
||||
GetTextData( *zone )->zoneName = ev.name;
|
||||
}
|
||||
|
||||
void View::ProcessLockAnnounce( const QueueLockAnnounce& ev )
|
||||
{
|
||||
CheckSourceLocation( ev.srcloc );
|
||||
|
||||
auto ptr = m_slab.Alloc<LockEvent>();
|
||||
ptr->srcloc = ev.srcloc;
|
||||
|
||||
auto it = m_lockMap.find( ev.id );
|
||||
if( it == m_lockMap.end() )
|
||||
{
|
||||
m_lockMap.emplace( ev.id, ptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second = ptr;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock( m_lock );
|
||||
m_locks.push_back( ptr );
|
||||
}
|
||||
|
||||
void View::CheckString( uint64_t ptr )
|
||||
{
|
||||
if( m_strings.find( ptr ) != m_strings.end() ) return;
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
void ProcessFrameMark( const QueueFrameMark& ev );
|
||||
void ProcessZoneText( const QueueZoneText& ev );
|
||||
void ProcessZoneName( const QueueZoneName& ev );
|
||||
void ProcessLockAnnounce( const QueueLockAnnounce& ev );
|
||||
|
||||
void CheckString( uint64_t ptr );
|
||||
void CheckThreadString( uint64_t id );
|
||||
@ -116,6 +117,7 @@ private:
|
||||
std::mutex m_lock;
|
||||
Vector<uint64_t> m_frames;
|
||||
Vector<ThreadData*> m_threads;
|
||||
Vector<LockEvent*> m_locks;
|
||||
std::unordered_map<uint64_t, std::string> m_strings;
|
||||
std::unordered_map<uint64_t, std::string> m_threadNames;
|
||||
std::unordered_set<const char*, charutil::Hasher, charutil::Comparator> m_customStrings;
|
||||
@ -132,6 +134,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, LockEvent*> m_lockMap;
|
||||
|
||||
Slab<EventSize*1024*1024> m_slab;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user