#[macro_use]
extern crate thread_profiler;
use std::vec::Vec;
fn main() {
println!(
"Running with thread_profler. Names prepended by '{}'",
module_path!()
);
thread_profiler::register_thread_with_profiler();
long_complex_function();
let output = "./profile.json";
println!("Writing output to {}", output);
thread_profiler::write_profile(output);
}
fn long_complex_function() {
profile_scope!("covering function");
let mut v = Vec::new();
{
profile_scope!("section 1");
v.push(1);
}
{
profile_scope!("section 2");
v.push(2);
}
v.push(3)
}