pprof-alloc 0.1.0

Allocation profiling and Linux memory telemetry for Rust services.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use smallvec::SmallVec;

pub fn trace() -> super::UnresolvedFrames {
	let mut bt: SmallVec<[u64; super::SOFT_MAX_DEPTH]> =
		SmallVec::with_capacity(super::SOFT_MAX_DEPTH);
	// Safety: not sure, it doesn't say why unsynchronized is unsafe. pprof-rs does this...
	unsafe {
		backtrace::trace_unsynchronized(|f| {
			bt.push(f.ip() as u64);
			true
		});
	}
	bt.into()
}