tracing-prof 0.3.0

Experimental library for profiling tracing spans.
Documentation
#![allow(missing_docs)]
use divan::bench;
use tracing_prof::allocator::{
    AllocationGroup, TrackingAllocator, enter_allocation_group, exit_allocation_group,
    flush_thread_statistics,
};

#[global_allocator]
static ALLOCATOR: TrackingAllocator = TrackingAllocator::system();

fn main() {
    divan::main();
}

#[bench(args = [100, 1000, 10000, 100_000, 1_000_000], sample_size = 100, sample_count = 100)]
fn allocs(n: u64) -> Vec<u64> {
    enter_allocation_group(AllocationGroup::from(tracing::span::Id::from_u64(
        99_232_932,
    )));

    let mut v = Vec::new();
    for i in 0..n {
        v.push(i);
    }

    exit_allocation_group();
    flush_thread_statistics();

    v
}