Skip to content

Comments

Add hits/misses ratio to stats#614

Closed
elichai wants to merge 1 commit intomozilla:mainfrom
elichai:2019-11-precent
Closed

Add hits/misses ratio to stats#614
elichai wants to merge 1 commit intomozilla:mainfrom
elichai:2019-11-precent

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.

}};
}

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.

3 participants