From 9413436ba1f6a4205fe2560fc6dbd00cd80d4b0b Mon Sep 17 00:00:00 2001 From: Eric Eaton Date: Mon, 7 Jul 2025 17:55:50 -0700 Subject: [PATCH] Search backward for the correct zone Needed to make tracing more intense applications work. --- server/TracyWorker.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 09e3cf8e..d438383d 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -6044,9 +6044,15 @@ void Worker::ProcessGpuZoneAnnotation( const QueueGpuZoneAnnotation& ev ) // TODO: Get thread ID properly // TODO: Search for the query from the back assert( ctx->threadData.size() ); - assert( ctx->threadData.begin()->second.timeline.size() ); - auto & zone = ctx->threadData.begin()->second.timeline.back(); - assert( zone->query_id == ev.queryId ); + auto & timeline = ctx->threadData.begin()->second.timeline; + assert( timeline.size() ); + ssize_t i = timeline.size() - 1; + for ( ; i >= 0 ; i--) { + if( timeline[i]->query_id == ev.queryId ) { + break; + } + } + auto& zone = timeline[i]; assert( zone->note_count < 10 ); zone->note_ids[zone->note_count] = ev.noteId; zone->note_vals[zone->note_count] = ev.value;