Capture kernel frames on Linux.

Garbage frames ("markers") have to be filtered out.
This commit is contained in:
Bartosz Taudul 2021-06-12 14:35:43 +02:00
parent ed50447f7a
commit 0a954fda87
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -780,7 +780,6 @@ static void SetupSampling( int64_t& samplingPeriod )
#if LINUX_VERSION_CODE >= KERNEL_VERSION( 4, 8, 0 )
pe.sample_max_stack = 127;
#endif
pe.exclude_callchain_kernel = 1;
pe.disabled = 1;
pe.freq = 1;
pe.inherit = 1;
@ -999,23 +998,15 @@ static void SetupSampling( int64_t& samplingPeriod )
}
#endif
// skip kernel frames
uint64_t j;
for( j=0; j<cnt; j++ )
for( uint64_t j=1; j<=cnt; j++ )
{
if( (int64_t)trace[j+1] >= 0 ) break;
if( trace[j] >= (uint64_t)-4095 ) // PERF_CONTEXT_MAX
{
memmove( trace+j, trace+j+1, sizeof( uint64_t ) * ( cnt - j ) );
cnt--;
}
if( j == cnt )
{
tracy_free_fast( trace );
}
else
{
if( j > 0 )
{
cnt -= j;
memmove( trace+1, trace+1+j, sizeof( uint64_t ) * cnt );
}
memcpy( trace, &cnt, sizeof( uint64_t ) );
TracyLfqPrepare( QueueType::CallstackSample );
@ -1026,7 +1017,6 @@ static void SetupSampling( int64_t& samplingPeriod )
}
}
}
}
else
{
// Layout: