Repository navigation
Coderabbit - #2931
Closed
janisozaur wants to merge 11 commits into
Closed
Coderabbit#2931janisozaur wants to merge 11 commits into
janisozaur wants to merge 11 commits into
Conversation
Add the Chrome Trace Event infrastructure (event serialization, virtual worker-track allocation, task-local context, span guard) and the `trace_file` / SCCACHE_TRACE setting. The server opens the trace file at startup and terminates it on shutdown. No compilation spans are emitted yet. Co-Authored-By: Claude Code <noreply@anthropic.com>
Lease a worker track per compile request and hold it until the compile finishes, so concurrent compilations never share a track. Each request produces a `compile: <output>` slice annotated with the compiler and the outcome (Hit, Miss, NotCached, NotCacheable, CompileFailed or Error). Co-Authored-By: Claude Code <noreply@anthropic.com>
The daemon trace test was restricted to Unix when it started compiling with `cc`, which dropped the start/stop coverage on Windows. It is now a `test_case` pair that runs on every non-macOS platform: a start-and-stop case that checks the trace file is written and parses, and a compile case that runs `sccache rustc` twice and asserts a Miss followed by a Hit on the same worker track. The compile case uses rustc, which avoids needing a C compiler on the test host. Co-Authored-By: Claude Code <noreply@anthropic.com>
The compile body runs in a spawned task, which does not inherit the task-local trace context. Spans created inside it, such as nested parsing spans, were therefore recorded on the background track instead of the compilation's worker track. Capture the context before spawning and scope the spawned future with it. Co-Authored-By: Claude Code <noreply@anthropic.com>
Record a span for compiler argument parsing, for scanning the preprocessor output for includes, for checking each cached include file, and for parsing rustc dep-info. They nest under the compile slice on its worker track. The daemon trace tests now also cover a C compile that hits the preprocessor cache, and assert the new spans for the rustc compile case. Co-Authored-By: Claude Code <noreply@anthropic.com>
A miss on the preprocessor cache showed only the compile result, so the trace could not say which header caused it. Each failing scan_file span now carries a miss_reason arg (stat, size, open, read, digest, time_macro).
External tool executions were invisible: a C miss spent ~40 ms unaccounted and rustc detection ~100 ms per request. Adds tool: detect_compiler around compiler probing, tool: preprocess around the preprocessor invocation and tool: compile around the local compiler invocation. tests/server.rs asserts the spans appear once per miss and not on hits, on the compilation worker track.
Cache backend activity was invisible: a hit spent most of its time in storage.get and a backfill to a faster level was not on any track. Adds storage: {cache_type} get/put spans around the base storage calls (the put span lands inside the compile slice because the deferred write future is awaited there) and a backfill: L{from} -> L{to} span on the background track (pid 2) for each spawned backfill task. tests/server.rs checks the storage spans per hit/miss; a multilevel unit test checks the backfill span lands on the background track.
Perfetto counter events (ph: "C") on the metrics track (pid 0): a "Cache Totals" sample per compile result (hits, misses, errors) and a "Tier L{idx} ({cache_type})" sample per level at the end of MultiLevelStorage get/put_raw, so hit rates and per-tier activity render as time-series graphs. Tests: a trace.rs unit test for the counter API, an integration test asserting the Cache Totals samples track the hit/miss counts, and the multilevel test asserting tier counter samples exist.
Author
|
Sorry, not ready yet - didn't mean to push to upstream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.