Process thread group hints.

This commit is contained in:
Bartosz Taudul 2024-08-03 19:55:27 +02:00
parent 9a9f1c2ab9
commit 28a9750f8a
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 14 additions and 0 deletions

View File

@ -688,6 +688,7 @@ struct ThreadData
uint8_t isFiber; uint8_t isFiber;
ThreadData* fiber; ThreadData* fiber;
uint8_t* stackCount; uint8_t* stackCount;
int32_t groupHint;
tracy_force_inline void IncStackCount( int16_t srcloc ) { stackCount[uint16_t(srcloc)]++; } tracy_force_inline void IncStackCount( int16_t srcloc ) { stackCount[uint16_t(srcloc)]++; }
tracy_force_inline bool DecStackCount( int16_t srcloc ) { return --stackCount[uint16_t(srcloc)] != 0; } tracy_force_inline bool DecStackCount( int16_t srcloc ) { return --stackCount[uint16_t(srcloc)] != 0; }

View File

@ -1054,6 +1054,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks, bool allow
f.Skip( ssz * ( 8 + 3 ) ); f.Skip( ssz * ( 8 + 3 ) );
} }
} }
td->groupHint = 0;
m_data.threads[i] = td; m_data.threads[i] = td;
m_threadMap.emplace( tid, td ); m_threadMap.emplace( tid, td );
} }
@ -3464,6 +3465,7 @@ ThreadData* Worker::NewThread( uint64_t thread, bool fiber )
td->fiber = nullptr; td->fiber = nullptr;
td->stackCount = (uint8_t*)m_slab.AllocBig( sizeof( uint8_t ) * 64*1024 ); td->stackCount = (uint8_t*)m_slab.AllocBig( sizeof( uint8_t ) * 64*1024 );
memset( td->stackCount, 0, sizeof( uint8_t ) * 64*1024 ); memset( td->stackCount, 0, sizeof( uint8_t ) * 64*1024 );
td->groupHint = 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.first = thread;
@ -4680,6 +4682,9 @@ bool Worker::Process( const QueueItem& ev )
case QueueType::MemNamePayload: case QueueType::MemNamePayload:
ProcessMemNamePayload( ev.memName ); ProcessMemNamePayload( ev.memName );
break; break;
case QueueType::ThreadGroupHint:
ProcessThreadGroupHint( ev.threadGroupHint );
break;
case QueueType::FiberEnter: case QueueType::FiberEnter:
ProcessFiberEnter( ev.fiberEnter ); ProcessFiberEnter( ev.fiberEnter );
break; break;
@ -6862,6 +6867,13 @@ void Worker::ProcessMemNamePayload( const QueueMemNamePayload& ev )
m_memNamePayload = ev.name; m_memNamePayload = ev.name;
} }
void Worker::ProcessThreadGroupHint( const QueueThreadGroupHint& ev )
{
auto td = RetrieveThread( ev.thread );
assert( td );
td->groupHint = ev.groupHint;
}
void Worker::ProcessFiberEnter( const QueueFiberEnter& ev ) void Worker::ProcessFiberEnter( const QueueFiberEnter& ev )
{ {
const auto t = TscTime( RefTime( m_refTimeThread, ev.time ) ); const auto t = TscTime( RefTime( m_refTimeThread, ev.time ) );

View File

@ -768,6 +768,7 @@ private:
tracy_force_inline void ProcessSourceCodeNotAvailable( const QueueSourceCodeNotAvailable& ev ); tracy_force_inline void ProcessSourceCodeNotAvailable( const QueueSourceCodeNotAvailable& ev );
tracy_force_inline void ProcessCpuTopology( const QueueCpuTopology& ev ); tracy_force_inline void ProcessCpuTopology( const QueueCpuTopology& ev );
tracy_force_inline void ProcessMemNamePayload( const QueueMemNamePayload& ev ); tracy_force_inline void ProcessMemNamePayload( const QueueMemNamePayload& ev );
tracy_force_inline void ProcessThreadGroupHint( const QueueThreadGroupHint& ev );
tracy_force_inline void ProcessFiberEnter( const QueueFiberEnter& ev ); tracy_force_inline void ProcessFiberEnter( const QueueFiberEnter& ev );
tracy_force_inline void ProcessFiberLeave( const QueueFiberLeave& ev ); tracy_force_inline void ProcessFiberLeave( const QueueFiberLeave& ev );