winstacks 0.1.0-alpha2

Collect CPU call stack samples from a windows process
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Binary to run a command under winstacks and generate a file with all the collected call stacks and their counts

fn main() -> Result<(), winstacks::Error> {
    let mut args = std::env::args_os().skip(1);
    let arg0 = args
        .next()
        .expect("Expected command to run.\nUSAGE: winstack.exe [command] [command args...]");
    let trace_ctx = winstacks::trace_command(arg0, &args.collect::<Vec<_>>())?;

    let f = std::fs::File::create("./out.stacks").expect("Unable to create file");
    let mut f = std::io::BufWriter::new(f);
    trace_ctx.write_dtrace(&mut f)?;

    Ok(())
}