#performance #counter #events #perf #pmu

bin+lib perfcnt

Library to configure and read hardware performance counters in rust

10 releases

✓ Uses Rust 2018 edition

0.4.2 Feb 27, 2019
0.4.0 Sep 28, 2018
0.3.1 Feb 27, 2019
0.3.0 Sep 8, 2016
0.0.2 Nov 29, 2015

#45 in Hardware support

Download history 7/week @ 2018-11-15 16/week @ 2018-11-22 99/week @ 2018-11-29 9/week @ 2018-12-06 10/week @ 2018-12-13 21/week @ 2018-12-20 3/week @ 2018-12-27 8/week @ 2019-01-03 10/week @ 2019-01-10 1/week @ 2019-01-17 3/week @ 2019-01-24 10/week @ 2019-01-31 2/week @ 2019-02-14 21/week @ 2019-02-21

51 downloads per month

MIT license

111KB
2.5K SLoC

perfcnt Build Status Crates.io

A library to program performance counters in rust.

Documentation

Provided Programs

  • perfcnt-list: Lists all architecture specific events available on the current machine (currently only supports Intel x86).

Known limitations

  • Linux support without breakpoints and tracepoints
  • No Windows or MacOS X support
  • Missing raw AMD and ARM aarch64 events

lib.rs:

Example usage:

use perfcnt::{AbstractPerfCounter, PerfCounter};
use perfcnt::linux::{PerfCounterBuilderLinux, HardwareEventType};

let mut pc: PerfCounter =
    PerfCounterBuilderLinux::from_hardware_event(HardwareEventType::CacheMisses)
        .finish().expect("Could not create the counter");
pc.start().expect("Can not start the counter");
pc.stop().expect("Can not start the counter");
let res = pc.read().expect("Can not read the counter");
println!("Measured {} cache misses.", res);

Dependencies

~4.5MB
~44K SLoC