macro_rules! enhanced_system_profile {
($output_dir:expr, $sample_interval:expr, $block:block) => { ... };
}
Expand description
Enhanced profiling macro for comprehensive system analysis
Automatically starts full system profiling, runs the provided code block, then stops profiling and generates a comprehensive report that includes CPU, GPU, memory, I/O, and network analysis.
§Arguments
output_dir
- Directory for storing analysis resultssample_interval
- How often to sample system resourcesblock
- Code block to analyze
§Example
use memscope_rs::enhanced_system_profile;
use std::time::Duration;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let result = enhanced_system_profile!("./analysis", Duration::from_millis(200), {
// Your CPU/GPU/memory intensive code here
let data = vec![0u8; 10_000_000]; // 10MB allocation
// Simulate CPU work
for i in 0..100000u64 {
let _ = i.wrapping_mul(i);
}
data.len()
});
println!("Processed {} bytes", result);
Ok(())
}