#memory #pprof #data #run-time #profile #hala

hala-pprof-memory

A memory profile data collector for pprof

4 releases

0.2.19 Sep 8, 2024
0.2.18 Sep 8, 2024
0.2.17 Sep 8, 2024
0.2.16 Sep 8, 2024

#105 in Profiling

Download history 153/week @ 2024-09-02 94/week @ 2024-09-09

247 downloads per month
Used in xstack-kad

MIT license

84KB
2K SLoC

A pprof profiler implementation for rust programs

CI Release Crates.io Version docs.rs

This project writes runtime profiling data in the format expected by the pprof visualization tool.


lib.rs:

An implementation of GlobalAlloc that supports memory profiling and whose output reports are compatible with pprof.

The below code enables memory profiling in rust programs.

use hala_pprof_memory::PprofAlloc;

#[global_allocator]
static ALLOC: PprofAlloc = PprofAlloc(10);

PprofAlloc does not automatically generate memory profiling reports, the developers need to manually call snapshot function to generate them.

use hala_pprof_memory::{PprofAlloc,snapshot};

#[global_allocator]
static ALLOC: PprofAlloc = PprofAlloc(10);

fn main() {
    loop {
        // working...
        // generate report.
        snapshot();
    }
}

Dependencies

~4–13MB
~148K SLoC