Emit pthread ids for sampled callstacks on Apple platforms

Previously mach thread ids were emitted, which wouldn't match those
recorded in instrumented zones.
This commit is contained in:
Jonathan Hargreaves
2026-10-01 23:23:05 +01:00
parent 41bb4f58b4
commit f977c27ab7

View File

@@ -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 )