diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 9aa5d04a..0507505d 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1017,6 +1017,7 @@ Profiler::Profiler() , m_broadcast( nullptr ) , m_noExit( false ) , m_zoneId( 1 ) + , m_pid( GetPid() ) , m_stream( LZ4_createStream() ) , m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) ) , m_bufferOffset( 0 ) @@ -1172,8 +1173,6 @@ void Profiler::Worker() const auto hostinfo = GetHostInfo(); const auto hisz = std::min( strlen( hostinfo ), WelcomeMessageHostInfoSize - 1 ); - const uint64_t pid = GetPid(); - #ifdef TRACY_ON_DEMAND uint8_t onDemand = 1; #else @@ -1193,7 +1192,7 @@ void Profiler::Worker() MemWrite( &welcome.delay, m_delay ); MemWrite( &welcome.resolution, m_resolution ); MemWrite( &welcome.epoch, m_epoch ); - MemWrite( &welcome.pid, pid ); + MemWrite( &welcome.pid, m_pid ); MemWrite( &welcome.onDemand, onDemand ); MemWrite( &welcome.isApple, isApple ); memcpy( welcome.programName, procname, pnsz ); diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index c3ef4eb8..9258dfad 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -446,6 +446,8 @@ public: void SendString( uint64_t ptr, const char* str, QueueType type ); + uint64_t Pid() const { return m_pid; } + private: enum class DequeueStatus { Success, ConnectionLost, QueueEmpty }; @@ -541,6 +543,7 @@ private: UdpBroadcast* m_broadcast; bool m_noExit; std::atomic m_zoneId; + uint64_t m_pid; uint64_t m_threadCtx; int64_t m_refTimeThread;