feat: Bazel integration cookbook + default_output_path helper - #70
Merged
Merged
Conversation
Adds snmalloc-rs/docs/bazel.md cookbook covering the recommended
profile-output path resolution chain (SNMALLOC_PROFILE_OUT >
TEST_UNDECLARED_OUTPUTS_DIR > $TMPDIR/heap_{pid}.folded), BES upload
size considerations, and an example rust_test snippet.
Adds profile::default_output_path() in snmalloc-rs/src/profile.rs
(gated on the profiling feature) that implements the chain at the
bottom of the file -- outside the HeapProfile impl block so it
merges cleanly past the in-flight write_flamegraph rename PR.
README.md gains a single-line pointer to docs/bazel.md near the
existing heap-profiling section.
Verification: cargo build -p snmalloc-rs and cargo build -p snmalloc-rs
--features profiling both clean; cargo test -p snmalloc-rs --features
profiling --test profile_default_output_path covers the env-var
precedence chain end to end.
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.
What: New
snmalloc-rs/docs/bazel.mdcookbook + newprofile::default_output_path()helper (gated onprofilingfeature) implementing the env-var path resolution chain (SNMALLOC_PROFILE_OUT>$TEST_UNDECLARED_OUTPUTS_DIR/heap.folded>$TMPDIR/heap_{pid}.folded). README gains a one-line pointer to the cookbook.Why: Operators running snmalloc-rs heap-profile capture under
bazel testneed a documented, copy-pasteable pattern for hooking the profile output into the Bazel test result store (BES) and a helper that picks the right path automatically. The helper sits outside theHeapProfileimpl so it merges cleanly past the in-flightwrite_flamegraphrename PR.Cost: +~80 LoC Rust (helper + docs), +~75 LoC Markdown (cookbook), +~100 LoC test. Zero runtime cost when feature off (whole helper compiled out). No new deps.
Evidence: Local verification only (fork CI is workflow_dispatch).
cargo build -p snmalloc-rscleancargo build -p snmalloc-rs --features profilingcleancargo test -p snmalloc-rs --features profiling --test profile_default_output_path-> 1 passed (env-var precedence chain exercised end-to-end)cargo test -p snmalloc-rs --features profiling --lib-> 33 passed (no regressions)cargo doc -p snmalloc-rs --features profiling --no-deps-> no new rustdoc warnings