mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Move ring identifier check out of the loop.
This commit is contained in:
parent
145e3e213a
commit
aee8336847
@ -1150,9 +1150,10 @@ void SysTraceWorker( void* ptr )
|
||||
|
||||
const auto id = ring.GetId();
|
||||
assert( id != EventContextSwitch );
|
||||
|
||||
const auto end = head - tail;
|
||||
uint64_t pos = 0;
|
||||
if( id == EventCallstack )
|
||||
{
|
||||
while( pos < end )
|
||||
{
|
||||
perf_event_header hdr;
|
||||
@ -1160,8 +1161,7 @@ void SysTraceWorker( void* ptr )
|
||||
if( hdr.type == PERF_RECORD_SAMPLE )
|
||||
{
|
||||
auto offset = pos + sizeof( perf_event_header );
|
||||
if( id == EventCallstack )
|
||||
{
|
||||
|
||||
// Layout:
|
||||
// u32 pid, tid
|
||||
// u64 time
|
||||
@ -1194,8 +1194,19 @@ void SysTraceWorker( void* ptr )
|
||||
TracyLfqCommit;
|
||||
}
|
||||
}
|
||||
pos += hdr.size;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( pos < end )
|
||||
{
|
||||
perf_event_header hdr;
|
||||
ring.Read( &hdr, pos, sizeof( perf_event_header ) );
|
||||
if( hdr.type == PERF_RECORD_SAMPLE )
|
||||
{
|
||||
auto offset = pos + sizeof( perf_event_header );
|
||||
|
||||
// Layout:
|
||||
// u64 ip
|
||||
// u64 time
|
||||
@ -1239,9 +1250,9 @@ void SysTraceWorker( void* ptr )
|
||||
MemWrite( &item->hwSample.time, t0 );
|
||||
TracyLfqCommit;
|
||||
}
|
||||
}
|
||||
pos += hdr.size;
|
||||
}
|
||||
}
|
||||
assert( pos == end );
|
||||
ring.Advance( end );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user