diff --git a/client/TracySysTrace.cpp b/client/TracySysTrace.cpp index a67fb18e..1b35fac1 100644 --- a/client/TracySysTrace.cpp +++ b/client/TracySysTrace.cpp @@ -1051,7 +1051,10 @@ bool SysTraceStart( int64_t& samplingPeriod ) pe.type = PERF_TYPE_TRACEPOINT; pe.size = sizeof( perf_event_attr ); pe.sample_period = 1; - pe.sample_type = PERF_SAMPLE_TIME | PERF_SAMPLE_RAW; + pe.sample_type = PERF_SAMPLE_TIME | PERF_SAMPLE_RAW | PERF_SAMPLE_CALLCHAIN; +#if LINUX_VERSION_CODE >= KERNEL_VERSION( 4, 8, 0 ) + pe.sample_max_stack = 127; +#endif pe.disabled = 1; pe.inherit = 1; pe.config = switchId; @@ -1075,6 +1078,7 @@ bool SysTraceStart( int64_t& samplingPeriod ) if( wakeupId != -1 ) { pe.config = wakeupId; + pe.config &= ~PERF_SAMPLE_CALLCHAIN; TracyDebug( "Setup wakeup capture\n" ); for( int i=0; icontextSwitch.reason, reason ); MemWrite( &item->contextSwitch.state, state ); TracyLfqCommit; + + if( cnt > 0 && prev_pid != 0 && CurrentProcOwnsThread( prev_pid ) ) + { + auto trace = GetCallstackBlock( cnt, ring, traceOffset ); + + TracyLfqPrepare( QueueType::CallstackSample ); + MemWrite( &item->callstackSampleFat.time, t0 ); + MemWrite( &item->callstackSampleFat.thread, prev_pid ); + MemWrite( &item->callstackSampleFat.ptr, (uint64_t)trace ); + TracyLfqCommit; + } } else {