smelt-perf 0.1.0

Lightweight allocation and timing instrumentation. Counting global allocator and labelled scope guards.
Documentation
  • Coverage
  • 22.45%
    11 out of 49 items documented0 out of 20 items with examples
  • Size
  • Source code size: 21.93 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 664.17 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s 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

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