Skip to content

feat: Bazel integration cookbook + default_output_path helper - #70

Merged
jayakasadev merged 1 commit into
mainfrom
feat/bazel-cookbook-default-output-path
Jun 16, 2026
Merged

jayakasadev merged 1 commit into
mainfrom
feat/bazel-cookbook-default-output-path

Conversation

@jayakasadev

Copy link
Copy Markdown
Owner

What: New snmalloc-rs/docs/bazel.md cookbook + new profile::default_output_path() helper (gated on profiling feature) 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 test need 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 the HeapProfile impl so it merges cleanly past the in-flight write_flamegraph rename 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-rs clean
  • cargo build -p snmalloc-rs --features profiling clean
  • cargo 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

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.
@jayakasadev
jayakasadev merged commit de266c6 into main Jun 16, 2026
@jayakasadev
jayakasadev deleted the feat/bazel-cookbook-default-output-path branch June 16, 2026 15:49
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.

1 participant