Properly save compressed thread in GPU events.

This commit is contained in:
Bartosz Taudul 2018-06-20 23:12:49 +02:00
parent 1856d057c1
commit 2a618c90d5
2 changed files with 9 additions and 4 deletions

View File

@ -131,9 +131,9 @@ struct GpuEvent
int64_t gpuStart;
int64_t gpuEnd;
int32_t srcloc;
uint16_t thread;
// All above is read/saved as-is.
// This must be last. All above is read/saved as-is.
uint16_t thread;
Vector<GpuEvent*> child;
};

View File

@ -2368,7 +2368,10 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size )
auto zone = m_slab.AllocInit<GpuEvent>();
vec.push_back_no_space_check( zone );
f.Read( zone, sizeof( GpuEvent ) - sizeof( GpuEvent::child ) );
f.Read( zone, sizeof( GpuEvent::cpuStart ) + sizeof( GpuEvent::cpuEnd ) + sizeof( GpuEvent::gpuStart ) + sizeof( GpuEvent::gpuEnd ) + sizeof( GpuEvent::srcloc ) );
uint64_t thread;
f.Read( thread );
zone->thread = CompressThread( thread );
ReadTimeline( f, zone->child );
}
}
@ -2581,7 +2584,9 @@ void Worker::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec )
for( auto& v : vec )
{
f.Write( v, sizeof( GpuEvent ) - sizeof( GpuEvent::child ) );
f.Write( v, sizeof( GpuEvent::cpuStart ) + sizeof( GpuEvent::cpuEnd ) + sizeof( GpuEvent::gpuStart ) + sizeof( GpuEvent::gpuEnd ) + sizeof( GpuEvent::srcloc ) );
uint64_t thread = DecompressThread( v->thread );
f.Write( &thread, sizeof( thread ) );
WriteTimeline( f, v->child );
}
}