diff --git a/public/client/TracySysTrace.cpp b/public/client/TracySysTrace.cpp index 35b1ccfe..e106e3b1 100644 --- a/public/client/TracySysTrace.cpp +++ b/public/client/TracySysTrace.cpp @@ -1270,19 +1270,39 @@ void SysTraceWorker( void* ptr ) uint16_t active[512]; uint32_t end[512]; uint32_t pos[512]; + int64_t time[512]; + + auto PrimeNext = [&pos, &end, &time]( int idx, RingBuffer& ring ) { + while( pos[idx] < end[idx] ) + { + perf_event_header hdr; + ring.Read( &hdr, pos[idx], sizeof( hdr ) ); + if( hdr.type == PERF_RECORD_SAMPLE ) + { + ring.Read( time + idx, pos[idx] + sizeof( hdr ), sizeof( int64_t ) ); + return true; + } + assert( hdr.size > 0 ); + pos[idx] += hdr.size; + } + return false; + }; + for( int i=0; i= 0 ) { + assert( pos[sel] < end[sel] ); + auto& ring = ringArray[ctxBufferIdx + sel]; auto rbPos = pos[sel]; auto offset = rbPos; @@ -1483,15 +1481,12 @@ void SysTraceWorker( void* ptr ) } rbPos += hdr.size; - if( rbPos == end[sel] ) + pos[sel] = rbPos; + if( !PrimeNext( sel, ring ) ) { active[selPos] = active[activeNum - 1]; activeNum--; } - else - { - pos[sel] = rbPos; - } } } for( int i=0; i