Keep refTime in a register.

This commit is contained in:
Bartosz Taudul 2020-02-12 20:59:36 +01:00
parent 39d24d0d4a
commit 8e825d91e0
2 changed files with 17 additions and 12 deletions

View File

@ -946,13 +946,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read2( tid, td->count ); f.Read2( tid, td->count );
td->id = tid; td->id = tid;
m_data.zonesCnt += td->count; m_data.zonesCnt += td->count;
int64_t refTime = 0;
if( fileVer < FileVersion( 0, 6, 3 ) ) if( fileVer < FileVersion( 0, 6, 3 ) )
{ {
uint64_t tsz; uint64_t tsz;
f.Read( tsz ); f.Read( tsz );
if( tsz != 0 ) if( tsz != 0 )
{ {
int64_t refTime = 0;
ReadTimelinePre063( f, td->timeline, tsz, refTime, childIdx, fileVer ); ReadTimelinePre063( f, td->timeline, tsz, refTime, childIdx, fileVer );
} }
} }
@ -962,7 +962,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( tsz ); f.Read( tsz );
if( tsz != 0 ) if( tsz != 0 )
{ {
ReadTimeline( f, td->timeline, tsz, refTime, childIdx ); ReadTimeline( f, td->timeline, tsz, 0, childIdx );
} }
} }
uint64_t msz; uint64_t msz;
@ -5042,25 +5042,26 @@ void Worker::ReconstructContextSwitchUsage()
} }
#endif #endif
void Worker::ReadTimeline( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx ) int64_t Worker::ReadTimeline( FileRead& f, ZoneEvent* zone, int64_t refTime, int32_t& childIdx )
{ {
uint32_t sz; uint32_t sz;
f.Read( sz ); f.Read( sz );
ReadTimelineHaveSize( f, zone, refTime, childIdx, sz ); return ReadTimelineHaveSize( f, zone, refTime, childIdx, sz );
} }
void Worker::ReadTimelineHaveSize( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx, uint32_t sz ) int64_t Worker::ReadTimelineHaveSize( FileRead& f, ZoneEvent* zone, int64_t refTime, int32_t& childIdx, uint32_t sz )
{ {
if( sz == 0 ) if( sz == 0 )
{ {
zone->SetChild( -1 ); zone->SetChild( -1 );
return refTime;
} }
else else
{ {
const auto idx = childIdx; const auto idx = childIdx;
childIdx++; childIdx++;
zone->SetChild( idx ); zone->SetChild( idx );
ReadTimeline( f, m_data.zoneChildren[idx], sz, refTime, childIdx ); return ReadTimeline( f, m_data.zoneChildren[idx], sz, refTime, childIdx );
} }
} }
@ -5175,7 +5176,7 @@ void Worker::CountZoneStatistics( ZoneEvent* zone )
} }
#endif #endif
void Worker::ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint32_t size, int64_t& refTime, int32_t& childIdx ) int64_t Worker::ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint32_t size, int64_t refTime, int32_t& childIdx )
{ {
assert( size != 0 ); assert( size != 0 );
const auto lp = s_loadProgress.subProgress.load( std::memory_order_relaxed ); const auto lp = s_loadProgress.subProgress.load( std::memory_order_relaxed );
@ -5193,13 +5194,17 @@ void Worker::ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint
f.Read4( srcloc, tstart, zone->extra, childSz ); f.Read4( srcloc, tstart, zone->extra, childSz );
refTime += tstart; refTime += tstart;
zone->SetStartSrcLoc( refTime, srcloc ); zone->SetStartSrcLoc( refTime, srcloc );
ReadTimelineHaveSize( f, zone, refTime, childIdx, childSz ); refTime = ReadTimelineHaveSize( f, zone, refTime, childIdx, childSz );
zone->SetEnd( ReadTimeOffset( f, refTime ) ); int64_t tend;
f.Read( tend );
refTime += tend;
zone->SetEnd( refTime );
#ifdef TRACY_NO_STATISTICS #ifdef TRACY_NO_STATISTICS
CountZoneStatistics( zone ); CountZoneStatistics( zone );
#endif #endif
} }
while( ++zone != end ); while( ++zone != end );
return refTime;
} }
void Worker::ReadTimelinePre063( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint64_t size, int64_t& refTime, int32_t& childIdx, int fileVer ) void Worker::ReadTimelinePre063( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint64_t size, int64_t& refTime, int32_t& childIdx, int fileVer )

View File

@ -616,8 +616,8 @@ private:
void ReconstructContextSwitchUsage(); void ReconstructContextSwitchUsage();
#endif #endif
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx ); tracy_force_inline int64_t ReadTimeline( FileRead& f, ZoneEvent* zone, int64_t refTime, int32_t& childIdx );
tracy_force_inline void ReadTimelineHaveSize( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx, uint32_t sz ); tracy_force_inline int64_t ReadTimelineHaveSize( FileRead& f, ZoneEvent* zone, int64_t refTime, int32_t& childIdx, uint32_t sz );
tracy_force_inline void ReadTimelinePre063( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx, int fileVer ); tracy_force_inline void ReadTimelinePre063( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx, int fileVer );
tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx ); tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx );
tracy_force_inline void ReadTimelineHaveSize( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx, uint64_t sz ); tracy_force_inline void ReadTimelineHaveSize( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx, uint64_t sz );
@ -632,7 +632,7 @@ private:
tracy_force_inline ZoneExtra& GetZoneExtraMutable( const ZoneEvent& ev ) { return m_data.zoneExtra[ev.extra]; } tracy_force_inline ZoneExtra& GetZoneExtraMutable( const ZoneEvent& ev ) { return m_data.zoneExtra[ev.extra]; }
tracy_force_inline void AllocZoneExtra( ZoneEvent& ev ); tracy_force_inline void AllocZoneExtra( ZoneEvent& ev );
void ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint32_t size, int64_t& refTime, int32_t& childIdx ); int64_t ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint32_t size, int64_t refTime, int32_t& childIdx );
void ReadTimelinePre063( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int32_t& childIdx, int fileVer ); void ReadTimelinePre063( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int32_t& childIdx, int fileVer );
void ReadTimeline( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx ); void ReadTimeline( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx );
void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer ); void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer );