Skip to content

[CAS] Implemented llvm-cas --show-stat - #221

Open
slydiman wants to merge 2 commits into
swift/nextfrom
swift/cas-diag-stats
Open

slydiman wants to merge 2 commits into
swift/nextfrom
swift/cas-diag-stats

Conversation

@slydiman

@slydiman slydiman commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Added the CAS statistics stored in the binary stats file in CAS directory.
llvm-cas --show-stats -cas <CASPath> shows something like

llvm-cas: stats:
Cache hits:                      766
Cache misses:                    924
Cache misses (result_not_found): 0
Cache backend output not found:  0
Cache skipped:                   0
Average depscan:                 0.122599 s (1690)
Average backend key query:       0.000005 s (1690)
Average backend key update:      0.000011 s (853)
Average backend load:            0.003442 s (766)
Average backend store:           0.000018 s (853)
Cache location: <CASPath>

llvm-cas --zero-stats -cas <CASPath> resets the statistics.
Note the compiler should use -Xclang -Rcompile-job-cache-timing -Xclang -Rcompile-job-cache to get it working.
We can disable CacheStatsDiagnosticConsumer if compile-job-cache remarks are disabled.
We can create custom remarks enabled by default and add extra Diag.Report() wherever compile-job-cache-* are reported.
Note TextDiagnosticPrinter will print compile-job-cache or any custom remarks anyway to stdout.

@slydiman
slydiman requested review from andreil99, asl and tagolog October 8, 2026 17:36
@slydiman
slydiman force-pushed the swift/cas-diag-stats branch 2 times, most recently from ea855a8 to 6483165 Compare October 8, 2026 19:11
@slydiman
slydiman force-pushed the swift/cas-diag-stats branch from 6483165 to 3379b4a Compare October 9, 2026 08:32

//SmallString<100> MsgBuf;
//Info.FormatDiagnostic(MsgBuf);
// std::string Message(MsgBuf);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this commented-out code still needed, or can we safely remove it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, we can remove it.

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