Struct cpu_cycles_reader::CyclesReader
source · pub struct CyclesReader { /* private fields */ }Implementations§
source§impl CyclesReader
impl CyclesReader
sourcepub fn enable(&self)
pub fn enable(&self)
Enable Cycles monitoring
ⓘ
use cpu_cycles_reader::CyclesReader;
let reader = CyclesReader::new(&[0, 1, 2, 3]).unwrap();
reader.enable();sourcepub fn disable(&self)
pub fn disable(&self)
Disable Cycles monitoring
ⓘ
use cpu_cycles_reader::CyclesReader;
let reader = CyclesReader::new(&[0, 1, 2, 3]).unwrap();
reader.disable();sourcepub fn read(&self) -> Result<HashMap<c_int, Cycles>, &'static str>
pub fn read(&self) -> Result<HashMap<c_int, Cycles>, &'static str>
Read the number of Cycles from start to present
According to the CPU number, it is collected as a std::collections::HashMap, which is convenient for on-demand reading
Errors
If there is an error when calling the syscall, it will return an error
Trait Implementations§
source§impl Drop for CyclesReader
impl Drop for CyclesReader
impl Send for CyclesReader
Auto Trait Implementations§
impl RefUnwindSafe for CyclesReader
impl !Sync for CyclesReader
impl Unpin for CyclesReader
impl UnwindSafe for CyclesReader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more