cpu-instructions-reader

perf_event_read package specialized for reading cpu hw instructions

3 unstable releases

0.3.2 Sep 20, 2024
0.3.1 Sep 20, 2024
0.2.1 Sep 21, 2024
0.2.0 Aug 8, 2024
0.1.0 Aug 8, 2024
Download history 184/week @ 2024-08-04 19/week @ 2024-08-11 455/week @ 2024-09-15 122/week @ 2024-09-22 15/week @ 2024-09-29 5/week @ 2024-10-13

366 downloads per month

WTFPL license

14KB
283 lines

This is only specialized for reading Cpu Instructions, not a complete package of perf_event_open

Permission requirements ⚠ : Make sure the program has ROOT permissions


lib.rs:

This is only for reading CpuInstructionNumber specialization, not a complete package of perf_event_read

Example:

use std::{fs, time::{Duration, Instant}, thread};
use cpu_instructions_reader::{InstructionNumber, InstructionNumberReader, InstructionNumberInstant};

let reader = InstructionNumberReader::new().unwrap();
let record_1 = reader.instant(0).unwrap();

thread::sleep(Duration::from_secs(1));

let record_2 = reader.instant(0).unwrap();
let instructions = record_2 - record_1;

println!("{instructions}");

Dependencies

~0.3–1.1MB
~24K SLoC