Load time offsets to scratch buffers.

This commit is contained in:
Bartosz Taudul 2019-02-15 02:46:25 +01:00
parent 8fd685c877
commit c127f51767

View File

@ -3330,8 +3330,10 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread
s_loadProgress.subProgress.fetch_add( 1, std::memory_order_relaxed ); s_loadProgress.subProgress.fetch_add( 1, std::memory_order_relaxed );
auto zone = m_slab.Alloc<ZoneEvent>(); auto zone = m_slab.Alloc<ZoneEvent>();
vec[i] = zone; vec[i] = zone;
zone->start = ReadTimeOffset( f, refTime ); // Use zone->end as scratch buffer for zone start time offset.
f.Read( &zone->srcloc, sizeof( zone->srcloc ) + sizeof( zone->cpu_start ) + sizeof( zone->cpu_end ) + sizeof( zone->text ) + sizeof( zone->callstack ) + sizeof( zone->name ) ); f.Read( &zone->end, sizeof( zone->end ) + sizeof( zone->srcloc ) + sizeof( zone->cpu_start ) + sizeof( zone->cpu_end ) + sizeof( zone->text ) + sizeof( zone->callstack ) + sizeof( zone->name ) );
refTime += zone->end;
zone->start = refTime;
ReadTimeline( f, zone, thread, refTime ); ReadTimeline( f, zone, thread, refTime );
zone->end = ReadTimeOffset( f, refTime ); zone->end = ReadTimeOffset( f, refTime );
ReadTimelineUpdateStatistics( zone, thread ); ReadTimelineUpdateStatistics( zone, thread );
@ -3382,9 +3384,13 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, i
auto zone = m_slab.Alloc<GpuEvent>(); auto zone = m_slab.Alloc<GpuEvent>();
vec[i] = zone; vec[i] = zone;
zone->cpuStart = ReadTimeOffset( f, refTime ); // Use zone->gpuStart as scratch buffer for CPU zone start time offset.
zone->gpuStart = ReadTimeOffset( f, refGpuTime ); // Use zone->gpuEnd as scratch buffer for GPU zone start time offset.
f.Read2( zone->srcloc, zone->callstack ); f.Read( &zone->gpuStart, sizeof( zone->gpuStart ) + sizeof( zone->gpuEnd ) + sizeof( zone->srcloc ) + sizeof( zone->callstack ) );
refTime += zone->gpuStart;
refGpuTime += zone->gpuEnd;
zone->cpuStart = refTime;
zone->gpuStart = refGpuTime;
uint64_t thread; uint64_t thread;
f.Read( thread ); f.Read( thread );