bmk_linux 0.2.2

My collection of useful stuff for writing benchmarks on Linux ~4.4 (not very idiomatic or complete).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::str::from_utf8;
use std::process::Command;

/// A typed thin wrapper around `pgrep`.
///
/// Returns either the PID of the process or `None`
pub fn pgrep(name: &str) -> Option<isize> {
    let output = Command::new("pgrep").arg(name).output().unwrap();
    if output.status.success() {
        let pid = from_utf8(&output.stdout).unwrap().trim().parse().unwrap();
        Some(pid)
    } else {
        None
    }
}