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 show-adv-stats flag which shows per compiler hits/misses #1904

Merged
merged 2 commits into from
Oct 24, 2023

Conversation

robertmaynard
Copy link
Collaborator

Adds the -show-adv-stats command line option to sccache which will show more details on the compiler hits/misses for each language and compiler.

Example of using sccache with clang, g++, and nvcc with C, C++, and CUDA sources:

/home/rmaynard/Work/sccache/target/debug/sccache --show-adv-stats
Compile requests                     18
Compile requests executed            18
Cache hits                            9
Cache hits (c [clang])                1
Cache hits (c [gcc])                  1
Cache hits (c [nvcc])                 1
Cache hits (c++ [clang])              1
Cache hits (c++ [gcc])                2
Cache hits (c++ [nvcc])               1
Cache hits (cuda [clang])             1
Cache hits (cuda [nvcc])              1
Cache misses                          9
Cache misses (c [clang])              1
Cache misses (c [gcc])                1
Cache misses (c [nvcc])               1
Cache misses (c++ [clang])            1
Cache misses (c++ [gcc])              2
Cache misses (c++ [nvcc])             1
Cache misses (cuda [clang])           1
Cache misses (cuda [nvcc])            1
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                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average compiler                  0.101 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/home/rmaynard/.cache/sccache"
Version (client)                0.5.4
Cache size                            5 KiB
Max cache size                       32 GiB

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2023

Codecov Report

Attention: 55 lines in your changes are missing coverage. Please review.

Comparison is base (b28d686) 29.68% compared to head (fc7cf62) 29.67%.
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1904      +/-   ##
==========================================
- Coverage   29.68%   29.67%   -0.02%     
==========================================
  Files          50       50              
  Lines       17967    18024      +57     
  Branches     8662     8710      +48     
==========================================
+ Hits         5334     5348      +14     
- Misses       7469     7500      +31     
- Partials     5164     5176      +12     
Files Coverage Δ
src/commands.rs 17.52% <25.00%> (ø)
tests/sccache_cargo.rs 34.39% <0.00%> (-0.23%) ⬇️
src/cmdline.rs 15.97% <0.00%> (-0.58%) ⬇️
src/compiler/compiler.rs 37.32% <50.00%> (+0.17%) ⬆️
tests/system.rs 22.33% <21.73%> (-0.03%) ⬇️
src/server.rs 31.18% <17.39%> (-1.13%) ⬇️

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sylvestre
Copy link
Collaborator

LGTM

Maybe you could test this into some integration-tests ?

@robertmaynard
Copy link
Collaborator Author

LGTM

Maybe you could test this into some integration-tests ?

I will look into extending tests/system.rs to validate the advanced stats. IIRC the primary sticking point was that I was hesitant to re-implement the CompilerKind mapping of compiler names to nice strings. That will be needed to verify the hits/misses are in the correct bucket.

Thinking about it more, the tests/system.rs has a subset of compilers so the mapping should be easy to implement

@robertmaynard
Copy link
Collaborator Author

@sylvestre Extended some of the tests/system.rs to verify the advanced keys. Happy to iterate a better design / test for this if needed

@sylvestre sylvestre merged commit 377bc96 into mozilla:main Oct 24, 2023
38 of 39 checks passed
@sylvestre
Copy link
Collaborator

thanks :)

@robertmaynard robertmaynard deleted the fea/verbose_compiler_details branch October 24, 2023 15:36
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