mirror of
https://github.com/wolfpld/tracy
synced 2025-05-06 07:03:52 +00:00
Cache last searched ThreadData.
This commit is contained in:
parent
8a0701025d
commit
a76622d17a
@ -2131,11 +2131,13 @@ void Worker::InsertMessageData( MessageData* msg, uint64_t thread )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadData* Worker::NoticeThread( uint64_t thread )
|
ThreadData* Worker::NoticeThreadReal( uint64_t thread )
|
||||||
{
|
{
|
||||||
auto it = m_threadMap.find( thread );
|
auto it = m_threadMap.find( thread );
|
||||||
if( it != m_threadMap.end() )
|
if( it != m_threadMap.end() )
|
||||||
{
|
{
|
||||||
|
m_data.threadDataLast.first = thread;
|
||||||
|
m_data.threadDataLast.second = it->second;
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2153,6 +2155,8 @@ ThreadData* Worker::NewThread( uint64_t thread )
|
|||||||
td->nextZoneId = 0;
|
td->nextZoneId = 0;
|
||||||
m_data.threads.push_back( td );
|
m_data.threads.push_back( td );
|
||||||
m_threadMap.emplace( thread, td );
|
m_threadMap.emplace( thread, td );
|
||||||
|
m_data.threadDataLast.first = thread;
|
||||||
|
m_data.threadDataLast.second = td;
|
||||||
return td;
|
return td;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ private:
|
|||||||
|
|
||||||
struct DataBlock
|
struct DataBlock
|
||||||
{
|
{
|
||||||
DataBlock() : zonesCnt( 0 ), lastTime( 0 ), frameOffset( 0 ), threadLast( std::numeric_limits<uint64_t>::max(), 0 ) {}
|
DataBlock() : zonesCnt( 0 ), lastTime( 0 ), frameOffset( 0 ), threadLast( std::numeric_limits<uint64_t>::max(), 0 ), threadDataLast( std::numeric_limits<uint64_t>::max(), nullptr ) {}
|
||||||
|
|
||||||
std::shared_mutex lock;
|
std::shared_mutex lock;
|
||||||
StringDiscovery<FrameData*> frames;
|
StringDiscovery<FrameData*> frames;
|
||||||
@ -177,6 +177,7 @@ private:
|
|||||||
flat_hash_map<uint64_t, uint16_t, nohash<uint64_t>> threadMap;
|
flat_hash_map<uint64_t, uint16_t, nohash<uint64_t>> threadMap;
|
||||||
Vector<uint64_t> threadExpand;
|
Vector<uint64_t> threadExpand;
|
||||||
std::pair<uint64_t, uint16_t> threadLast;
|
std::pair<uint64_t, uint16_t> threadLast;
|
||||||
|
std::pair<uint64_t, ThreadData*> threadDataLast;
|
||||||
|
|
||||||
Vector<Vector<ZoneEvent*>> zoneChildren;
|
Vector<Vector<ZoneEvent*>> zoneChildren;
|
||||||
Vector<Vector<GpuEvent*>> gpuChildren;
|
Vector<Vector<GpuEvent*>> gpuChildren;
|
||||||
@ -430,8 +431,13 @@ private:
|
|||||||
|
|
||||||
void InsertMessageData( MessageData* msg, uint64_t thread );
|
void InsertMessageData( MessageData* msg, uint64_t thread );
|
||||||
|
|
||||||
|
ThreadData* NoticeThreadReal( uint64_t thread );
|
||||||
ThreadData* NewThread( uint64_t thread );
|
ThreadData* NewThread( uint64_t thread );
|
||||||
ThreadData* NoticeThread( uint64_t thread );
|
ThreadData* NoticeThread( uint64_t thread )
|
||||||
|
{
|
||||||
|
if( m_data.threadDataLast.first == thread ) return m_data.threadDataLast.second;
|
||||||
|
return NoticeThreadReal( thread );
|
||||||
|
}
|
||||||
|
|
||||||
tracy_force_inline void NewZone( ZoneEvent* zone, uint64_t thread );
|
tracy_force_inline void NewZone( ZoneEvent* zone, uint64_t thread );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user