From a3ba188af5c1f0d28828a02c738c07866b8f5c3c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 15 Nov 2017 22:21:02 +0100 Subject: [PATCH] Manual initialization of GpuEvents. --- server/TracyEvent.hpp | 3 +++ server/TracyView.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 4fe0744c..c6f18fe9 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -108,6 +108,8 @@ static_assert( std::numeric_limits::max() >= Max struct GpuEvent { + void Init() { memset( &child, 0, 12 ); } + int64_t cpuStart; int64_t cpuEnd; int64_t gpuStart; @@ -118,6 +120,7 @@ struct GpuEvent }; enum { GpuEventSize = sizeof( GpuEvent ) }; +static_assert( sizeof( GpuEvent::child ) == 13, "Adjust vector clear size!" ); #pragma pack() diff --git a/server/TracyView.cpp b/server/TracyView.cpp index bcf99732..2f9cc731 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -855,7 +855,9 @@ void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev ) CheckSourceLocation( ev.srcloc ); - auto zone = m_slab.AllocInit(); + auto zone = m_slab.Alloc(); + zone->Init(); + zone->cpuStart = ev.cpuTime * m_timerMul; zone->cpuEnd = -1; zone->gpuStart = std::numeric_limits::max(); @@ -3871,7 +3873,9 @@ void View::ReadTimeline( FileRead& f, Vector& vec ) for( uint64_t i=0; i(); + auto zone = m_slab.Alloc(); + zone->Init(); + vec.push_back( zone ); f.Read( &zone->cpuStart, sizeof( zone->cpuStart ) );