1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-03 14:03:52 +00:00

Set start and srcloc in one go.

This commit is contained in:
Bartosz Taudul 2020-02-12 20:16:14 +01:00
parent 5c6bfcbeee
commit 39d24d0d4a

View File

@ -315,9 +315,8 @@ Worker::Worker( const std::string& program, const std::vector<ImportEventTimelin
} }
auto zone = AllocZoneEvent(); auto zone = AllocZoneEvent();
zone->SetStart( v.timestamp ); zone->SetStartSrcLoc( v.timestamp, key );
zone->SetEnd( -1 ); zone->SetEnd( -1 );
zone->SetSrcLoc( key );
zone->SetChild( -1 ); zone->SetChild( -1 );
m_threadCtxData = NoticeThread( v.tid ); m_threadCtxData = NoticeThread( v.tid );
@ -3453,9 +3452,8 @@ void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
const auto refTime = m_refTimeThread + ev.time; const auto refTime = m_refTimeThread + ev.time;
m_refTimeThread = refTime; m_refTimeThread = refTime;
const auto start = TscTime( refTime - m_data.baseTime ); const auto start = TscTime( refTime - m_data.baseTime );
zone->SetStart( start ); zone->SetStartSrcLoc( start, ShrinkSourceLocation( ev.srcloc ) );
zone->SetEnd( -1 ); zone->SetEnd( -1 );
zone->SetSrcLoc( ShrinkSourceLocation( ev.srcloc ) );
zone->SetChild( -1 ); zone->SetChild( -1 );
if( m_data.lastTime < start ) m_data.lastTime = start; if( m_data.lastTime < start ) m_data.lastTime = start;
@ -3506,9 +3504,8 @@ void Worker::ProcessZoneBeginAllocSrcLocImpl( ZoneEvent* zone, const QueueZoneBe
const auto refTime = m_refTimeThread + ev.time; const auto refTime = m_refTimeThread + ev.time;
m_refTimeThread = refTime; m_refTimeThread = refTime;
const auto start = TscTime( refTime - m_data.baseTime ); const auto start = TscTime( refTime - m_data.baseTime );
zone->SetStart( start ); zone->SetStartSrcLoc( start, it->second );
zone->SetEnd( -1 ); zone->SetEnd( -1 );
zone->SetSrcLoc( it->second );
zone->SetChild( -1 ); zone->SetChild( -1 );
if( m_data.lastTime < start ) m_data.lastTime = start; if( m_data.lastTime < start ) m_data.lastTime = start;
@ -5194,9 +5191,8 @@ void Worker::ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint
int64_t tstart; int64_t tstart;
uint32_t childSz; uint32_t childSz;
f.Read4( srcloc, tstart, zone->extra, childSz ); f.Read4( srcloc, tstart, zone->extra, childSz );
zone->SetSrcLoc( srcloc );
refTime += tstart; refTime += tstart;
zone->SetStart( refTime ); zone->SetStartSrcLoc( refTime, srcloc );
ReadTimelineHaveSize( f, zone, refTime, childIdx, childSz ); ReadTimelineHaveSize( f, zone, refTime, childIdx, childSz );
zone->SetEnd( ReadTimeOffset( f, refTime ) ); zone->SetEnd( ReadTimeOffset( f, refTime ) );
#ifdef TRACY_NO_STATISTICS #ifdef TRACY_NO_STATISTICS