thag_profiler 1.0.1

A lightweight, cross-platform Rust code profiling toolkit with zero overhead when disabled
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[cfg(feature = "full_profiling")]
use thag_profiler::create_memory_task;

#[test]
#[cfg(feature = "full_profiling")]
fn test_basic_allocation() {
    // Create a memory task
    let _task = create_memory_task();

    // Do some allocations
    let data1: Vec<u8> = vec![0; 1024];
    let data2: Vec<u8> = vec![0; 2048];

    // Keep data in scope
    println!("Data sizes: {}, {}", data1.len(), data2.len());
}