auto_trace

Macro auto_trace 

Source
macro_rules! auto_trace {
    ($output_dir:expr, $block:block) => { ... };
}
Expand description

Auto-tracking macro for scoped memory analysis

Automatically starts tracking, runs the provided code block, then stops tracking and generates reports. Perfect for analyzing specific code sections.

§Arguments

  • output_dir - Directory for storing analysis results
  • block - Code block to analyze

§Example

use memscope_rs::auto_trace;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let result = auto_trace!("./analysis", {
        let data = vec![1, 2, 3, 4, 5];
        data.len()
    });
    assert_eq!(result, 5);
    Ok(())
}