From e8fc30ee05496f2b3e57c1a44e33b6480f5140a2 Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Thu, 26 Jun 2025 08:14:05 +0200 Subject: Do not store empty cache hit counts --- compiler/rustc_data_structures/src/profiling.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_data_structures/src') diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index bd3eb11a6d6..2903155421c 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -521,13 +521,18 @@ impl SelfProfilerRef { let builder = EventIdBuilder::new(&profiler.profiler); let thread_id = get_thread_id(); for (query_invocation, hit_count) in query_hits.iter().enumerate() { - let event_id = builder.from_label(StringId::new_virtual(query_invocation as u64)); - profiler.profiler.record_integer_event( - profiler.query_cache_hit_count_event_kind, - event_id, - thread_id, - hit_count.load(Ordering::Relaxed), - ); + let hit_count = hit_count.load(Ordering::Relaxed); + // No need to record empty cache hit counts + if hit_count > 0 { + let event_id = + builder.from_label(StringId::new_virtual(query_invocation as u64)); + profiler.profiler.record_integer_event( + profiler.query_cache_hit_count_event_kind, + event_id, + thread_id, + hit_count, + ); + } } } } -- cgit 1.4.1-3-g733a5