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 |
#157 in Profiling
Used in xstack-kad
84KB
2K
SLoC
A pprof
profiler implementation for rust programs
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–14MB
~149K SLoC