Search backward for the correct zone

Needed to make tracing more intense applications work.
This commit is contained in:
Eric Eaton
2025-07-07 17:55:50 -07:00
parent d1f9df8058
commit 9413436ba1

View File

@@ -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;