pub struct BacktraceReport(pub Vec<(HashedBacktrace, BacktraceMetric)>);Expand description
A report of all (post-filter) backtraces and their associated allocations metrics.
Tuple Fields§
§0: Vec<(HashedBacktrace, BacktraceMetric)>Implementations§
Source§impl BacktraceReport
impl BacktraceReport
Sourcepub fn csv(&self) -> String
pub fn csv(&self) -> String
Examples found in repository?
examples/example.rs (line 28)
12fn main() {
13 let (sender, receiver) = mpsc::channel();
14 std::thread::Builder::new()
15 .name("thread2".to_string())
16 .spawn(move || thread(receiver))
17 .unwrap();
18
19 let mut last_print = Instant::now();
20 loop {
21 let buf = vec![1u8; 1024];
22 sender.send(buf).ok();
23 std::thread::sleep(Duration::from_millis(100));
24 if last_print.elapsed() > Duration::from_secs(10) {
25 last_print = Instant::now();
26 let report = alloc_track::backtrace_report(|_, _| true);
27 println!("BACKTRACES\n{report}");
28 println!("BACKTRACES CSV\n{}", report.csv());
29 let report = alloc_track::thread_report();
30 println!("THREADS\n{report}");
31 }
32 }
33}Trait Implementations§
Auto Trait Implementations§
impl Freeze for BacktraceReport
impl RefUnwindSafe for BacktraceReport
impl Send for BacktraceReport
impl Sync for BacktraceReport
impl Unpin for BacktraceReport
impl UnwindSafe for BacktraceReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more