Skip to content

Add support for reading aggregated query cache hit counts #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Jul 4, 2025

This adds support to the analysis module for aggregated query cache hit counts, which were added to rustc in rust-lang/rust#142978. I tried to keep compatibility with the original (very expensive) per-query-invocation cache hit counters.

// Aggregated query cache hit counts
QUERY_CACHE_HIT_COUNT_EVENT_KIND => {
record_event_data(&current_event.label, &|data| {
data.number_of_cache_hits = value as usize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we assert that it was zero before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. All the cache counts should be at the end, and we read in .rev() order, but it would be better to check. That being said, the aggregated and per-query-invocation counters should be the same; if not, something is very wrong.. 😆 Added an assert.

@Kobzol Kobzol force-pushed the query-cache-hits branch from e5bff14 to 8384a39 Compare July 4, 2025 13:44
Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have absolutely no clue which of my roles give me write permissions here, so take this approval as one by a non-measureme expert

@Kobzol
Copy link
Member Author

Kobzol commented Jul 4, 2025

It's through t-compiler, not just t-mods 😆 You're one of the few people who actually understand the query system, so I take what I can get. Thanks!

@Kobzol Kobzol merged commit b8af7fc into rust-lang:master Jul 4, 2025
4 checks passed
@Kobzol Kobzol deleted the query-cache-hits branch July 4, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants