From f977c27ab72d30cdbeabad2e4a2ec39479b632da Mon Sep 17 00:00:00 2001 From: Jonathan Hargreaves Date: Thu, 1 Oct 2026 23:23:05 +0100 Subject: [PATCH] Emit pthread ids for sampled callstacks on Apple platforms Previously mach thread ids were emitted, which wouldn't match those recorded in instrumented zones. --- public/client/apple/TracyMach.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/client/apple/TracyMach.cpp b/public/client/apple/TracyMach.cpp index 5c01d43a..cf7f6223 100644 --- a/public/client/apple/TracyMach.cpp +++ b/public/client/apple/TracyMach.cpp @@ -105,7 +105,13 @@ static void SysTraceSampleThread( mach_port_t tid ) thread_resume( tid ); - SysTraceEmitCallstackSample( (uint32_t)tid, timestamp, frames, depth ); + uint64_t pthreadId = tid; + if( pthread_t pt = pthread_from_mach_thread_np( tid ) ) + { + pthread_threadid_np( pt, &pthreadId ); + } + + SysTraceEmitCallstackSample( (uint32_t)pthreadId, timestamp, frames, depth ); } static void SysTraceWait( uint64_t deadline )