pub struct CpuSampler { /* private fields */ }Expand description
Measures this process’s CPU use between samples. Owned by the caller: two
monitors keep two samplers and never disturb each other. sample never
blocks and allocates nothing.
use std::time::Duration;
let mut cpu = sys_lib::process::CpuSampler::new()?;
std::thread::sleep(Duration::from_millis(50));
let u = cpu.sample()?;
println!("this process: {:.1}% of one core, {} of the machine", u.of_one_core, u.of_machine);Implementations§
Source§impl CpuSampler
impl CpuSampler
Trait Implementations§
Auto Trait Implementations§
impl Forget for CpuSampler
impl Freeze for CpuSampler
impl Move for CpuSampler
impl RefUnwindSafe for CpuSampler
impl Send for CpuSampler
impl Sync for CpuSampler
impl Unpin for CpuSampler
impl UnsafeUnpin for CpuSampler
impl UnwindSafe for CpuSampler
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