Repository navigation
feat(snmalloc-tools): rate-report subcommand + snapshot-vs-streaming docs - #73
Merged
Merged
Conversation
…docs Adds a `rate-report` subcommand to snmalloc-tools that stream-parses a JSON-Lines streaming event log and emits per-site (alloc_count, dealloc_count, peak_live_bytes, alloc_rate_per_sec) rows as CSV or a fixed-width table. Reader is strictly streaming — 6M-event logs use O(distinct sites) memory. Defines the JSONL on-disk schema for snmalloc streaming sessions (kind / site / size / ts_ns). Adds a "When to use snapshot vs streaming" section to snmalloc-rs README documenting the tradeoff: snapshot biased toward long-lived state, streaming captures transient churn — use streaming + rate-report for hot-path alloc-rate optimisation. New integration tests cover library round-trip and CLI surface (--help, default CSV, --pretty, --top truncation) against a worked 8-event fixture.
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-tools rate-reportsubcommand — stream-parses a JSON-Lines streaming event log and emits per-site rows(site, alloc_count, dealloc_count, peak_live_bytes, alloc_rate_per_sec)as CSV (default) or a fixed-width table (--pretty). Also adds a "When to use snapshot vs streaming" section tosnmalloc-rs/README.mdand documents the streaming-log on-disk schema insnmalloc-tools/README.md.Why:
snapshot()is biased toward long-lived state and misses transient churn — a hot allocate-and-free site disappears before the snapshot is taken. Operators optimising a hot path need per-site allocation rate, which only the streaming-log path can answer. This adds the offline analysis half (the producer half is the existingProfilingSession::startcallback).Cost: ~390 LOC in
snmalloc-tools/src/rate_report.rs+ ~30 LOC main.rs wiring + ~150 LOC tests + ~80 LOC README. No new crate deps (reuses serde/serde_json/anyhow/clap already in the manifest). Strictly streaming reader: 6M-event logs use O(distinct sites) memory, not O(events).Evidence:
cargo test -p snmalloc-tools— 26 unit tests + 6 existing integration tests + 8 newrate_report.rsintegration tests all pass.cargo run -p snmalloc-tools -- rate-report --helpshows the subcommand with--input,--top,--pretty.cargo build -p snmalloc-toolsclean. Local verification only (CI on fork is workflow_dispatch).