mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Separate message for zone begin with alloc src loc and callstack.
This commit is contained in:
parent
66b8a13e77
commit
bef31ba073
@ -227,7 +227,7 @@ static inline int LuaZoneBeginS( lua_State* L )
|
||||
auto token = GetToken();
|
||||
auto& tail = token->get_tail_index();
|
||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLoc );
|
||||
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLocCallstack );
|
||||
#ifdef TRACY_RDTSCP_OPT
|
||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime( item->zoneBegin.cpu ) );
|
||||
#else
|
||||
@ -293,7 +293,7 @@ static inline int LuaZoneBeginNS( lua_State* L )
|
||||
auto token = GetToken();
|
||||
auto& tail = token->get_tail_index();
|
||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLoc );
|
||||
MemWrite( &item->hdr.type, QueueType::ZoneBeginAllocSrcLocCallstack );
|
||||
#ifdef TRACY_RDTSCP_OPT
|
||||
MemWrite( &item->zoneBegin.time, Profiler::GetTime( item->zoneBegin.cpu ) );
|
||||
#else
|
||||
|
@ -1316,6 +1316,7 @@ static void FreeAssociatedMemory( const QueueItem& item )
|
||||
tracy_free( (void*)ptr );
|
||||
break;
|
||||
case QueueType::ZoneBeginAllocSrcLoc:
|
||||
case QueueType::ZoneBeginAllocSrcLocCallstack:
|
||||
ptr = MemRead<uint64_t>( &item.zoneBegin.srcloc );
|
||||
tracy_free( (void*)ptr );
|
||||
break;
|
||||
@ -1392,6 +1393,7 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
||||
tracy_free( (void*)ptr );
|
||||
break;
|
||||
case QueueType::ZoneBeginAllocSrcLoc:
|
||||
case QueueType::ZoneBeginAllocSrcLocCallstack:
|
||||
ptr = MemRead<uint64_t>( &item->zoneBegin.srcloc );
|
||||
SendSourceLocationPayload( ptr );
|
||||
tracy_free( (void*)ptr );
|
||||
|
@ -12,6 +12,7 @@ enum class QueueType : uint8_t
|
||||
ZoneName,
|
||||
Message,
|
||||
ZoneBeginAllocSrcLoc,
|
||||
ZoneBeginAllocSrcLocCallstack,
|
||||
CallstackMemory,
|
||||
Callstack,
|
||||
CallstackAlloc,
|
||||
@ -327,6 +328,7 @@ static const size_t QueueDataSize[] = {
|
||||
sizeof( QueueHeader ) + sizeof( QueueZoneText ), // zone name
|
||||
sizeof( QueueHeader ) + sizeof( QueueMessage ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location
|
||||
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location, callstack
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstackMemory ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstack ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstack ), // callstack alloc
|
||||
|
@ -2316,6 +2316,9 @@ bool Worker::Process( const QueueItem& ev )
|
||||
case QueueType::ZoneBeginAllocSrcLoc:
|
||||
ProcessZoneBeginAllocSrcLoc( ev.zoneBegin );
|
||||
break;
|
||||
case QueueType::ZoneBeginAllocSrcLocCallstack:
|
||||
ProcessZoneBeginAllocSrcLocCallstack( ev.zoneBegin );
|
||||
break;
|
||||
case QueueType::ZoneEnd:
|
||||
ProcessZoneEnd( ev.zoneEnd );
|
||||
break;
|
||||
@ -2407,6 +2410,7 @@ bool Worker::Process( const QueueItem& ev )
|
||||
ProcessCallstackMemory( ev.callstackMemory );
|
||||
break;
|
||||
case QueueType::Callstack:
|
||||
case QueueType::CallstackAlloc:
|
||||
ProcessCallstack( ev.callstack );
|
||||
break;
|
||||
case QueueType::CallstackFrameSize:
|
||||
@ -2470,13 +2474,11 @@ void Worker::ProcessZoneBeginCallstack( const QueueZoneBegin& ev )
|
||||
next.zone = zone;
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev )
|
||||
void Worker::ProcessZoneBeginAllocSrcLocImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
|
||||
{
|
||||
auto it = m_pendingSourceLocationPayload.find( ev.srcloc );
|
||||
assert( it != m_pendingSourceLocationPayload.end() );
|
||||
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
|
||||
zone->start = TscTime( ev.time );
|
||||
zone->end = -1;
|
||||
zone->srcloc = it->second;
|
||||
@ -2492,6 +2494,22 @@ void Worker::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev )
|
||||
m_pendingSourceLocationPayload.erase( it );
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
ProcessZoneBeginAllocSrcLocImpl( zone, ev );
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBeginAllocSrcLocCallstack( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
ProcessZoneBeginAllocSrcLocImpl( zone, ev );
|
||||
|
||||
auto& next = m_nextCallstack[ev.thread];
|
||||
next.type = NextCallstackType::Zone;
|
||||
next.zone = zone;
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
||||
{
|
||||
auto tit = m_threadMap.find( ev.thread );
|
||||
|
@ -351,6 +351,7 @@ private:
|
||||
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 ProcessZoneBeginAllocSrcLocCallstack( const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessZoneEnd( const QueueZoneEnd& ev );
|
||||
tracy_force_inline void ProcessZoneValidation( const QueueZoneValidation& ev );
|
||||
tracy_force_inline void ProcessFrameMark( const QueueFrameMark& ev );
|
||||
@ -387,6 +388,7 @@ private:
|
||||
tracy_force_inline void ProcessSysTime( const QueueSysTime& ev );
|
||||
|
||||
tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessZoneBeginAllocSrcLocImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev );
|
||||
|
||||
void ZoneStackFailure( uint64_t thread, const ZoneEvent* ev );
|
||||
|
Loading…
Reference in New Issue
Block a user