From d5ea8a86a42947810d4ddcc138d5073ebda59fe6 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 21 Nov 2017 02:10:41 +0100 Subject: [PATCH] Remove GPU context indirection. --- server/TracyView.cpp | 9 ++++----- server/TracyView.hpp | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1fad3099..470dc5c3 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -835,8 +835,6 @@ void View::ProcessMessageLiteral( const QueueMessage& ev ) void View::ProcessGpuNewContext( const QueueGpuNewContext& ev ) { 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 ); @@ -845,13 +843,14 @@ void View::ProcessGpuNewContext( const QueueGpuNewContext& ev ) gpu->count = 0; gpu->showFull = true; m_gpuData.push_back( gpu ); + m_gpuCtxMap.emplace( ev.context, gpu ); } void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev ) { auto it = m_gpuCtxMap.find( ev.context ); assert( it != m_gpuCtxMap.end() ); - auto ctx = m_gpuData[it->second]; + auto ctx = it->second; CheckSourceLocation( ev.srcloc ); @@ -879,7 +878,7 @@ void View::ProcessGpuZoneEnd( const QueueGpuZoneEnd& ev ) { auto it = m_gpuCtxMap.find( ev.context ); assert( it != m_gpuCtxMap.end() ); - auto ctx = m_gpuData[it->second]; + auto ctx = it->second; assert( !ctx->stack.empty() ); auto zone = ctx->stack.back_and_pop(); @@ -892,7 +891,7 @@ void View::ProcessGpuTime( const QueueGpuTime& ev ) { auto it = m_gpuCtxMap.find( ev.context ); assert( it != m_gpuCtxMap.end() ); - auto ctx = m_gpuData[it->second]; + auto ctx = 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 3af138cc..4da42310 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -191,7 +191,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_gpuCtxMap; flat_hash_map> m_plotMap; std::unordered_map m_plotRev; flat_hash_map> m_pendingPlots;