smelt-perf 0.1.3

Lightweight allocation and timing instrumentation. Counting global allocator and labelled scope guards.
Documentation
  • Coverage
  • 24%
    12 out of 50 items documented0 out of 21 items with examples
  • Size
  • Source code size: 23.41 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 674.96 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • leonardcser/smelt
    24 3 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • leonardcser
smelt-perf-0.1.3 has been yanked.

smelt-perf

Lightweight allocation and timing instrumentation.

Two coordinated pieces:

  • alloc::Counting: a global allocator shim that bumps process and per-thread counters when alloc::enable() has been called. Cheap when disabled.
  • perf::begin: RAII scope guards that record duration and per-thread alloc deltas under a &'static str label. Snapshot via perf::snapshot, pretty-print via perf::print_summary.

Designed to be embedded in any binary: install Counting as #[global_allocator], call alloc::enable() and perf::enable() early in main, then sprinkle let _g = perf::begin("scope.label"); around interesting scopes.

use smelt_perf::{alloc, perf};

#[global_allocator]
static A: alloc::Counting = alloc::Counting;

fn main() {
    alloc::enable();
    perf::enable();

    let _g = perf::begin("work");
    // ... do work ...
    drop(_g);

    perf::print_summary();
}

Part of the smelt project but usable standalone.

License

MIT