rsprof-trace 0.1.8

Self-instrumentation library for rsprof - captures CPU and heap traces
Documentation

Self-instrumentation library for rsprof.

This crate provides CPU and heap profiling through self-instrumentation:

  • CPU profiling: Timer-based sampling using SIGPROF
  • Heap profiling: Custom allocator that tracks allocations

Usage

Add to your Cargo.toml:

[dependencies]
rsprof-trace = { version = "0.1", features = ["profiling"] }

Enable profiling with the profiler! macro:

rsprof_trace::profiler!();  // CPU at 99Hz + heap profiling

Or customize the CPU sampling frequency:

rsprof_trace::profiler!(cpu = 199);  // CPU at 199Hz + heap profiling

Build with frame pointers for accurate stack traces:

RUSTFLAGS="-C force-frame-pointers=yes" cargo build --release --features profiling

When the profiling feature is disabled, the macro expands to a no-op allocator passthrough with zero overhead.