1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Implement callstack serialization.

This commit is contained in:
Bartosz Taudul
2021-10-10 16:14:17 +02:00
parent a421083e58
commit 5ccf369919
4 changed files with 42 additions and 6 deletions
+26 -2
View File
@@ -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
}
+2 -2
View File
@@ -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
}