2 stable releases
| 1.0.1 | Oct 9, 2023 |
|---|
#42 in #child-process
6KB
100 lines
command-rusage
Simple wrapper for linux wait4 syscall to get resource usage of a child process. This allows to measure multiple parameters of a child process, including CPU user/system times, memory usage, number of page faults, etc.
Usage
use command_rusage::GetRUsage;
use std::process::Command;
let mut child = Command::new("sleep").arg("1").spawn().unwrap();
let rusage = child.wait_for_rusage().unwrap();
println!("User time: {}s", rusage.utime.as_secs_f64());
Dependencies
~43KB