16 releases

0.7.1 Apr 7, 2021
0.7.0 Feb 27, 2021
0.6.0 Jun 18, 2020
0.5.0 Jun 8, 2019
0.0.2 Nov 29, 2015

#55 in Hardware support

Download history 14/week @ 2020-12-25 25/week @ 2021-01-01 34/week @ 2021-01-08 69/week @ 2021-01-15 41/week @ 2021-01-22 37/week @ 2021-01-29 83/week @ 2021-02-05 84/week @ 2021-02-12 181/week @ 2021-02-19 162/week @ 2021-02-26 89/week @ 2021-03-05 134/week @ 2021-03-12 186/week @ 2021-03-19 287/week @ 2021-03-26 168/week @ 2021-04-02 173/week @ 2021-04-09

507 downloads per month
Used in 4 crates

MIT license

115KB
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

~4MB
~40K SLoC