Issue just one read call per zone.

Separate reads are issued only for first and last of children.
This commit is contained in:
Bartosz Taudul 2020-02-13 18:11:54 +01:00
parent ebf2c3ad5b
commit 26584b00c3

View File

@ -5186,25 +5186,39 @@ int64_t Worker::ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, u
vec.set_magic(); vec.set_magic();
vec.reserve_exact( size, m_slab ); vec.reserve_exact( size, m_slab );
auto zone = vec.begin(); auto zone = vec.begin();
auto end = vec.end(); auto end = vec.end() - 1;
do
{
int16_t srcloc; int16_t srcloc;
int64_t tstart; int64_t tstart, tend;
uint32_t childSz; uint32_t childSz, extra;
f.Read4( srcloc, tstart, zone->extra, childSz ); f.Read4( srcloc, tstart, extra, childSz );
while( zone != end )
{
refTime += tstart; refTime += tstart;
zone->SetStartSrcLoc( refTime, srcloc ); zone->SetStartSrcLoc( refTime, srcloc );
zone->extra = extra;
refTime = ReadTimelineHaveSize( f, zone, refTime, childIdx, childSz );
f.Read5( tend, srcloc, tstart, extra, childSz );
refTime += tend;
zone->SetEnd( refTime );
#ifdef TRACY_NO_STATISTICS
CountZoneStatistics( zone );
#endif
zone++;
}
refTime += tstart;
zone->SetStartSrcLoc( refTime, srcloc );
zone->extra = extra;
refTime = ReadTimelineHaveSize( f, zone, refTime, childIdx, childSz ); refTime = ReadTimelineHaveSize( f, zone, refTime, childIdx, childSz );
int64_t tend;
f.Read( tend ); f.Read( tend );
refTime += tend; refTime += tend;
zone->SetEnd( refTime ); zone->SetEnd( refTime );
#ifdef TRACY_NO_STATISTICS #ifdef TRACY_NO_STATISTICS
CountZoneStatistics( zone ); CountZoneStatistics( zone );
#endif #endif
}
while( ++zone != end );
return refTime; return refTime;
} }