From 68f8bb906e4dcdef0582c984cd139c8ddfa4c2ec Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 18 Nov 2017 01:49:44 +0100 Subject: [PATCH] New context events are not serialized. --- server/TracyView.cpp | 20 +++++++++++++------- server/TracyView.hpp | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 6469f68b..917eb987 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -830,7 +830,10 @@ void View::ProcessMessageLiteral( const QueueMessage& ev ) void View::ProcessGpuNewContext( const QueueGpuNewContext& ev ) { - assert( ev.context == m_gpuData.size() ); + assert( m_gpuCtxMap.find( ev.context ) == m_gpuCtxMap.end() ); + const auto idx = m_gpuData.size(); + m_gpuCtxMap.emplace( ev.context, idx ); + auto gpu = m_slab.AllocInit(); gpu->timeDiff = int64_t( ev.cputime * m_timerMul - ev.gputime ); gpu->thread = ev.thread; @@ -842,8 +845,9 @@ void View::ProcessGpuNewContext( const QueueGpuNewContext& ev ) void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev ) { - assert( m_gpuData.size() >= ev.context ); - auto ctx = m_gpuData[ev.context]; + auto it = m_gpuCtxMap.find( ev.context ); + assert( it != m_gpuCtxMap.end() ); + auto ctx = m_gpuData[it->second]; CheckSourceLocation( ev.srcloc ); @@ -869,8 +873,9 @@ void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev ) void View::ProcessGpuZoneEnd( const QueueGpuZoneEnd& ev ) { - assert( m_gpuData.size() >= ev.context ); - auto ctx = m_gpuData[ev.context]; + auto it = m_gpuCtxMap.find( ev.context ); + assert( it != m_gpuCtxMap.end() ); + auto ctx = m_gpuData[it->second]; assert( !ctx->stack.empty() ); auto zone = ctx->stack.back(); @@ -882,8 +887,9 @@ void View::ProcessGpuZoneEnd( const QueueGpuZoneEnd& ev ) void View::ProcessGpuTime( const QueueGpuTime& ev ) { - assert( m_gpuData.size() >= ev.context ); - auto ctx = m_gpuData[ev.context]; + auto it = m_gpuCtxMap.find( ev.context ); + assert( it != m_gpuCtxMap.end() ); + auto ctx = m_gpuData[it->second]; auto zone = ctx->queue.front(); if( zone->gpuStart == std::numeric_limits::max() ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index ff1fa414..1b32dcf6 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -193,6 +193,7 @@ private: flat_hash_set> m_pendingSourceLocation; flat_hash_map> m_pendingCustomStrings; flat_hash_map> m_threadMap; + flat_hash_map> m_gpuCtxMap; flat_hash_map> m_plotMap; std::unordered_map m_plotRev; flat_hash_map> m_pendingPlots;