mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Implement callstack serialization.
This commit is contained in:
parent
a421083e58
commit
5ccf369919
@ -182,10 +182,10 @@ static tracy_force_inline void SendLuaCallstack( lua_State* L, uint32_t depth )
|
||||
}
|
||||
assert( dst - ptr == spaceNeeded + 2 );
|
||||
|
||||
TracyLfqPrepare( QueueType::CallstackAlloc );
|
||||
TracyQueuePrepare( QueueType::CallstackAlloc );
|
||||
MemWrite( &item->callstackAllocFat.ptr, (uint64_t)ptr );
|
||||
MemWrite( &item->callstackAllocFat.nativePtr, (uint64_t)Callstack( depth ) );
|
||||
TracyLfqCommit;
|
||||
TracyQueueCommit( callstackAllocFatThread );
|
||||
}
|
||||
|
||||
static inline int LuaZoneBeginS( lua_State* L )
|
||||
|
@ -2448,6 +2448,29 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
|
||||
tracy_free_fast( (void*)ptr );
|
||||
break;
|
||||
}
|
||||
case QueueType::Callstack:
|
||||
{
|
||||
ThreadCtxCheckSerial( callstackFatThread );
|
||||
ptr = MemRead<uint64_t>( &item->callstackFat.ptr );
|
||||
SendCallstackPayload( ptr );
|
||||
tracy_free_fast( (void*)ptr );
|
||||
break;
|
||||
}
|
||||
case QueueType::CallstackAlloc:
|
||||
{
|
||||
ThreadCtxCheckSerial( callstackAllocFatThread );
|
||||
ptr = MemRead<uint64_t>( &item->callstackAllocFat.nativePtr );
|
||||
if( ptr != 0 )
|
||||
{
|
||||
CutCallstack( (void*)ptr, "lua_pcall" );
|
||||
SendCallstackPayload( ptr );
|
||||
tracy_free_fast( (void*)ptr );
|
||||
}
|
||||
ptr = MemRead<uint64_t>( &item->callstackAllocFat.ptr );
|
||||
SendCallstackAlloc( ptr );
|
||||
tracy_free_fast( (void*)ptr );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
assert( false );
|
||||
@ -3141,11 +3164,12 @@ void Profiler::ReportTopology()
|
||||
void Profiler::SendCallstack( int depth, const char* skipBefore )
|
||||
{
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
TracyLfqPrepare( QueueType::Callstack );
|
||||
auto ptr = Callstack( depth );
|
||||
CutCallstack( ptr, skipBefore );
|
||||
|
||||
TracyQueuePrepare( QueueType::Callstack );
|
||||
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );
|
||||
TracyLfqCommit;
|
||||
TracyQueueCommit( callstackFatThread );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -548,9 +548,9 @@ public:
|
||||
{
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
auto ptr = Callstack( depth );
|
||||
TracyLfqPrepare( QueueType::Callstack );
|
||||
TracyQueuePrepare( QueueType::Callstack );
|
||||
MemWrite( &item->callstackFat.ptr, (uint64_t)ptr );
|
||||
TracyLfqCommit;
|
||||
TracyQueueCommit( callstackFatThread );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -453,12 +453,22 @@ struct QueueCallstackFat
|
||||
uint64_t ptr;
|
||||
};
|
||||
|
||||
struct QueueCallstackFatThread : public QueueCallstackFat
|
||||
{
|
||||
uint32_t thread;
|
||||
};
|
||||
|
||||
struct QueueCallstackAllocFat
|
||||
{
|
||||
uint64_t ptr;
|
||||
uint64_t nativePtr;
|
||||
};
|
||||
|
||||
struct QueueCallstackAllocFatThread : public QueueCallstackAllocFat
|
||||
{
|
||||
uint32_t thread;
|
||||
};
|
||||
|
||||
struct QueueCallstackSample
|
||||
{
|
||||
int64_t time;
|
||||
@ -633,7 +643,9 @@ struct QueueItem
|
||||
QueueMemFree memFree;
|
||||
QueueMemNamePayload memName;
|
||||
QueueCallstackFat callstackFat;
|
||||
QueueCallstackFatThread callstackFatThread;
|
||||
QueueCallstackAllocFat callstackAllocFat;
|
||||
QueueCallstackAllocFatThread callstackAllocFatThread;
|
||||
QueueCallstackSample callstackSample;
|
||||
QueueCallstackSampleFat callstackSampleFat;
|
||||
QueueCallstackFrameSize callstackFrameSize;
|
||||
|
Loading…
Reference in New Issue
Block a user