fn detect_hardware_events()

in netbench-collector/src/bpftrace.rs [392:401]


fn detect_hardware_events() -> Result<bool> {
    let out = Command::new("perf").arg("list").arg("hw").output()?;
    let out = core::str::from_utf8(&out.stdout)?;

    if out.contains("cycles") && out.contains("branches") && out.contains("instructions") {
        return Ok(true);
    }

    Ok(false)
}