about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-06-26 08:14:05 +0200
committerJakub Beránek <berykubik@gmail.com>2025-06-26 08:14:34 +0200
commite8fc30ee05496f2b3e57c1a44e33b6480f5140a2 (patch)
tree0cd8546cb98c58c54c1983f2308d81d3ac913da8
parent04ff853e13de10052ea03bcdc3c874eafa2deb5d (diff)
downloadrust-e8fc30ee05496f2b3e57c1a44e33b6480f5140a2.tar.gz
rust-e8fc30ee05496f2b3e57c1a44e33b6480f5140a2.zip
Do not store empty cache hit counts
-rw-r--r--compiler/rustc_data_structures/src/profiling.rs19
1 files changed, 12 insertions, 7 deletions
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,
+                    );
+                }
             }
         }
     }