command-rusage 1.0.1

Simple crate to get resource usage of a command
Documentation
  • Coverage
  • 96.15%
    25 out of 26 items documented0 out of 4 items with examples
  • Size
  • Source code size: 5.91 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.53 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • olix3001

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());