From 2a618c90d56e1854be75e7f064e2ed49045943fe Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 20 Jun 2018 23:12:49 +0200 Subject: [PATCH] Properly save compressed thread in GPU events. --- server/TracyEvent.hpp | 4 ++-- server/TracyWorker.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 7a453f46..c03cfa63 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -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 child; }; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 9f5fb910..59fa62ae 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -2368,7 +2368,10 @@ void Worker::ReadTimeline( FileRead& f, Vector& vec, uint64_t size ) auto zone = m_slab.AllocInit(); 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& 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 ); } }