Skip to content

Commit e8fc30e

Browse files
committed
Do not store empty cache hit counts
1 parent 04ff853 commit e8fc30e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

compiler/rustc_data_structures/src/profiling.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,18 @@ impl SelfProfilerRef {
521521
let builder = EventIdBuilder::new(&profiler.profiler);
522522
let thread_id = get_thread_id();
523523
for (query_invocation, hit_count) in query_hits.iter().enumerate() {
524-
let event_id = builder.from_label(StringId::new_virtual(query_invocation as u64));
525-
profiler.profiler.record_integer_event(
526-
profiler.query_cache_hit_count_event_kind,
527-
event_id,
528-
thread_id,
529-
hit_count.load(Ordering::Relaxed),
530-
);
524+
let hit_count = hit_count.load(Ordering::Relaxed);
525+
// No need to record empty cache hit counts
526+
if hit_count > 0 {
527+
let event_id =
528+
builder.from_label(StringId::new_virtual(query_invocation as u64));
529+
profiler.profiler.record_integer_event(
530+
profiler.query_cache_hit_count_event_kind,
531+
event_id,
532+
thread_id,
533+
hit_count,
534+
);
535+
}
531536
}
532537
}
533538
}

0 commit comments

Comments
 (0)