mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Handle ZoneBeginCallstack queue event.
This is identical to ZoneBegin handling, but requires some additional bookkeeping to account for the incoming callstack information.
This commit is contained in:
parent
b6088b908f
commit
978e168cbd
@ -1495,6 +1495,9 @@ void Worker::Process( const QueueItem& ev )
|
||||
case QueueType::ZoneBegin:
|
||||
ProcessZoneBegin( ev.zoneBegin );
|
||||
break;
|
||||
case QueueType::ZoneBeginCallstack:
|
||||
ProcessZoneBeginCallstack( ev.zoneBegin );
|
||||
break;
|
||||
case QueueType::ZoneBeginAllocSrcLoc:
|
||||
ProcessZoneBeginAllocSrcLoc( ev.zoneBegin );
|
||||
break;
|
||||
@ -1585,10 +1588,8 @@ void Worker::Process( const QueueItem& ev )
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBegin( const QueueZoneBegin& ev )
|
||||
void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
|
||||
CheckSourceLocation( ev.srcloc );
|
||||
|
||||
zone->start = TscTime( ev.time );
|
||||
@ -1602,6 +1603,22 @@ void Worker::ProcessZoneBegin( const QueueZoneBegin& ev )
|
||||
NewZone( zone, ev.thread );
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBegin( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
ProcessZoneBeginImpl( zone, ev );
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBeginCallstack( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
ProcessZoneBeginImpl( zone, ev );
|
||||
|
||||
auto& next = m_nextCallstack[ev.thread];
|
||||
next.type = NextCallstackType::Zone;
|
||||
next.zone = zone;
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto it = m_pendingSourceLocationPayload.find( ev.srcloc );
|
||||
|
@ -119,6 +119,20 @@ class Worker
|
||||
float compRatio;
|
||||
};
|
||||
|
||||
enum class NextCallstackType
|
||||
{
|
||||
Zone
|
||||
};
|
||||
|
||||
struct NextCallstack
|
||||
{
|
||||
NextCallstackType type;
|
||||
union
|
||||
{
|
||||
ZoneEvent* zone;
|
||||
};
|
||||
};
|
||||
|
||||
public:
|
||||
Worker( const char* addr );
|
||||
Worker( FileRead& f, EventType::Type eventMask = EventType::All );
|
||||
@ -197,6 +211,7 @@ private:
|
||||
tracy_force_inline void DispatchProcess( const QueueItem& ev, char*& ptr );
|
||||
tracy_force_inline void Process( const QueueItem& ev );
|
||||
tracy_force_inline void ProcessZoneBegin( const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessZoneBeginCallstack( const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessZoneEnd( const QueueZoneEnd& ev );
|
||||
tracy_force_inline void ProcessFrameMark( const QueueFrameMark& ev );
|
||||
@ -224,6 +239,8 @@ private:
|
||||
tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev );
|
||||
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev );
|
||||
|
||||
tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
||||
|
||||
tracy_force_inline void CheckSourceLocation( uint64_t ptr );
|
||||
void NewSourceLocation( uint64_t ptr );
|
||||
tracy_force_inline uint32_t ShrinkSourceLocation( uint64_t srcloc );
|
||||
@ -306,6 +323,7 @@ private:
|
||||
Vector<uint64_t> m_sourceLocationQueue;
|
||||
flat_hash_map<uint64_t, uint32_t, nohash<uint64_t>> m_sourceLocationShrink;
|
||||
flat_hash_map<uint64_t, ThreadData*, nohash<uint64_t>> m_threadMap;
|
||||
flat_hash_map<uint64_t, NextCallstack, nohash<uint64_t>> m_nextCallstack;
|
||||
|
||||
uint32_t m_pendingStrings;
|
||||
uint32_t m_pendingThreads;
|
||||
|
Loading…
Reference in New Issue
Block a user