1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

PIDs are no longer needed in samples.

This commit is contained in:
Bartosz Taudul 2021-05-23 19:00:45 +02:00
parent bbd1c4505c
commit b1e4d16537
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -788,7 +788,7 @@ static void SetupSampling( int64_t& samplingPeriod )
pe.type = PERF_TYPE_HARDWARE; pe.type = PERF_TYPE_HARDWARE;
pe.size = sizeof( perf_event_attr ); pe.size = sizeof( perf_event_attr );
pe.sample_freq = 10000; pe.sample_freq = 10000;
pe.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; pe.sample_type = PERF_SAMPLE_IP;
pe.disabled = 1; pe.disabled = 1;
pe.exclude_kernel = 1; pe.exclude_kernel = 1;
pe.exclude_guest = 1; pe.exclude_guest = 1;
@ -888,7 +888,6 @@ static void SetupSampling( int64_t& samplingPeriod )
SetThreadName( "Tracy Sampling" ); SetThreadName( "Tracy Sampling" );
sched_param sp = { 5 }; sched_param sp = { 5 };
pthread_setschedparam( pthread_self(), SCHED_FIFO, &sp ); pthread_setschedparam( pthread_self(), SCHED_FIFO, &sp );
uint32_t currentPid = (uint32_t)getpid();
#if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) #if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
for( int i=0; i<s_numBuffers; i++ ) for( int i=0; i<s_numBuffers; i++ )
{ {
@ -926,10 +925,6 @@ static void SetupSampling( int64_t& samplingPeriod )
// u64 cnt // u64 cnt
// u64 ip[cnt] // u64 ip[cnt]
uint32_t pid;
s_ring[i].Read( &pid, offset, sizeof( uint32_t ) );
if( pid == currentPid )
{
uint32_t tid; uint32_t tid;
uint64_t t0; uint64_t t0;
uint64_t cnt; uint64_t cnt;
@ -997,17 +992,11 @@ static void SetupSampling( int64_t& samplingPeriod )
} }
} }
} }
}
else else
{ {
// Layout: // Layout:
// u64 ip // u64 ip
// u32 pid, tid
uint32_t pid;
s_ring[i].Read( &pid, offset + sizeof( uint64_t ), sizeof( uint32_t ) );
if( pid == currentPid )
{
uint64_t ip; uint64_t ip;
s_ring[i].Read( &ip, offset, sizeof( uint64_t ) ); s_ring[i].Read( &ip, offset, sizeof( uint64_t ) );
@ -1042,7 +1031,6 @@ static void SetupSampling( int64_t& samplingPeriod )
TracyLfqCommit; TracyLfqCommit;
} }
} }
}
s_ring[i].Advance( hdr.size ); s_ring[i].Advance( hdr.size );
} }
if( !traceActive.load( std::memory_order_relaxed) ) break; if( !traceActive.load( std::memory_order_relaxed) ) break;