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

Process frame marks.

This commit is contained in:
Bartosz Taudul
2017-09-16 00:40:51 +02:00
parent 03ece0ac48
commit 3d0ddb960a
2 changed files with 24 additions and 3 deletions
+22 -1
View File
@@ -60,10 +60,13 @@ void View::Worker()
uint8_t lz4;
uint64_t bytes = 0;
uint64_t timeStart;
if( !m_sock.Read( &m_timeBegin, sizeof( m_timeBegin ), &tv, ShouldExit ) ) goto close;
if( !m_sock.Read( &timeStart, sizeof( timeStart ), &tv, ShouldExit ) ) goto close;
if( !m_sock.Read( &lz4, sizeof( lz4 ), &tv, ShouldExit ) ) goto close;
m_frames.push_back( timeStart );
t0 = std::chrono::high_resolution_clock::now();
for(;;)
@@ -169,6 +172,7 @@ void View::Process( const QueueItem& ev )
ProcessZoneEnd( ev.hdr.id, ev.zoneEnd );
break;
case QueueType::FrameMark:
ProcessFrameMark( ev.hdr.id );
break;
default:
assert( false );
@@ -220,6 +224,23 @@ void View::ProcessZoneEnd( uint64_t id, const QueueZoneEnd& ev )
}
}
void View::ProcessFrameMark( uint64_t id )
{
assert( !m_frames.empty() );
const auto lastframe = m_frames.back();
if( lastframe < id )
{
std::unique_lock<std::mutex> lock( m_lock );
m_frames.push_back( id );
}
else
{
auto it = std::lower_bound( m_frames.begin(), m_frames.end(), id );
std::unique_lock<std::mutex> lock( m_lock );
m_frames.insert( it, id );
}
}
void View::CheckString( uint64_t ptr )
{
if( m_strings.find( ptr ) != m_strings.end() ) return;