Skip to content
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

Add hits/misses ratio to stats #614

Closed
wants to merge 1 commit into from

Conversation

elichai
Copy link

@elichai elichai commented Dec 1, 2019

Hi,
This adds a ratio to the stats. it looks like this:

$ ./target/debug/sccache -s
Compile requests                    862
Compile requests executed           648
Cache hits                          239
Cache hits (Rust)                   239
Cache misses                        409
Cache misses (Rust)                 409
Cache hits rate                   36.88 %
Cache hits rate (Rust)            36.88 %
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                 211
Non-compilation calls                 0
Unsupported compiler calls            3
Average cache write               0.000 s
Average cache read miss           1.158 s
Average cache read hit            0.002 s
Failed distributed compilations       0

Non-cacheable reasons:
crate-type                          137
incremental                          50
-                                    16
-o                                    8

Cache location                  Local disk: "/home/elichai2/.cache/sccache"
Cache size                            8 GiB
Max cache size                       20 GiB

let mut sorted_stats_misses: Vec<_> = self.cache_misses.counts.iter().collect();
sorted_stats_misses.sort_by_key(|v| v.0);

for ((lang_hits, &count_hits), (lang_misses, &count_misses)) in sorted_stats_hits.into_iter().zip(sorted_stats_misses.into_iter()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this would work in the case where there are only hits or misses for a given language. You'd need to enumerate the intersection of all languages in hits and misses.

@@ -1221,6 +1221,14 @@ impl ServerStats {
}};
}

macro_rules! set_stat_precentage {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Following the style of other macros, this should be set_percentage_stat (also, you have a typo on percentage).

@glandium glandium added this to the 0.3.0 milestone Jan 8, 2021
@sylvestre
Copy link
Collaborator

inactive, closing

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.

None yet

3 participants