mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Move towards proper data structures.
This commit is contained in:
parent
4fad4be816
commit
c2bccf7126
@ -32,11 +32,29 @@ enum { EventSize = sizeof( Event ) };
|
|||||||
|
|
||||||
struct LockEvent
|
struct LockEvent
|
||||||
{
|
{
|
||||||
uint64_t srcloc;
|
enum class Type : uint8_t
|
||||||
|
{
|
||||||
|
Wait,
|
||||||
|
Obtain,
|
||||||
|
Release
|
||||||
|
};
|
||||||
|
|
||||||
|
int64_t time;
|
||||||
|
uint64_t thread;
|
||||||
|
Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { LockEventSize = sizeof( LockEvent ) };
|
enum { LockEventSize = sizeof( LockEvent ) };
|
||||||
|
|
||||||
|
|
||||||
|
struct LockTimeline
|
||||||
|
{
|
||||||
|
uint64_t id;
|
||||||
|
Vector<LockEvent*> timeline;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { LockTimelineSize = sizeof( LockTimeline ) };
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -454,14 +454,9 @@ void View::ProcessLockAnnounce( const QueueLockAnnounce& ev )
|
|||||||
{
|
{
|
||||||
CheckSourceLocation( ev.srcloc );
|
CheckSourceLocation( ev.srcloc );
|
||||||
|
|
||||||
auto ptr = m_slab.Alloc<LockEvent>();
|
|
||||||
ptr->srcloc = ev.srcloc;
|
|
||||||
|
|
||||||
assert( m_lockMap.find( ev.id ) == m_lockMap.end() );
|
|
||||||
m_lockMap.emplace( ev.id, ptr );
|
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock( m_lock );
|
std::lock_guard<std::mutex> lock( m_lock );
|
||||||
m_locks.push_back( ptr );
|
assert( m_lockMap.find( ev.id ) == m_lockMap.end() );
|
||||||
|
m_lockMap.emplace( ev.id, LockMap { ev.srcloc } );
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::CheckString( uint64_t ptr )
|
void View::CheckString( uint64_t ptr )
|
||||||
|
@ -44,6 +44,12 @@ private:
|
|||||||
Vector<Event*> timeline;
|
Vector<Event*> timeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LockMap
|
||||||
|
{
|
||||||
|
uint64_t srcloc;
|
||||||
|
LockTimeline ev;
|
||||||
|
};
|
||||||
|
|
||||||
void Worker();
|
void Worker();
|
||||||
|
|
||||||
void DispatchProcess( const QueueItem& ev );
|
void DispatchProcess( const QueueItem& ev );
|
||||||
@ -117,11 +123,11 @@ private:
|
|||||||
std::mutex m_lock;
|
std::mutex m_lock;
|
||||||
Vector<uint64_t> m_frames;
|
Vector<uint64_t> m_frames;
|
||||||
Vector<ThreadData*> m_threads;
|
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_strings;
|
||||||
std::unordered_map<uint64_t, std::string> m_threadNames;
|
std::unordered_map<uint64_t, std::string> m_threadNames;
|
||||||
std::unordered_set<const char*, charutil::Hasher, charutil::Comparator> m_customStrings;
|
std::unordered_set<const char*, charutil::Hasher, charutil::Comparator> m_customStrings;
|
||||||
std::unordered_map<uint64_t, QueueSourceLocation> m_sourceLocation;
|
std::unordered_map<uint64_t, QueueSourceLocation> m_sourceLocation;
|
||||||
|
std::unordered_map<uint64_t, LockMap> m_lockMap;
|
||||||
uint64_t m_zonesCnt;
|
uint64_t m_zonesCnt;
|
||||||
|
|
||||||
std::mutex m_mbpslock;
|
std::mutex m_mbpslock;
|
||||||
@ -134,7 +140,6 @@ 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, LockEvent*> m_lockMap;
|
|
||||||
|
|
||||||
Slab<EventSize*1024*1024> m_slab;
|
Slab<EventSize*1024*1024> m_slab;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user