pub struct CpuPower { /* private fields */ }Implementations§
Source§impl CpuPower
impl CpuPower
Sourcepub fn cores<'a>(&'a self) -> impl Iterator<Item = f64> + 'a
pub fn cores<'a>(&'a self) -> impl Iterator<Item = f64> + 'a
Get an iterator for all cpu cores in the system and their power draw in watt
Examples found in repository?
examples/power.rs (line 12)
3fn main() -> Result<(), Error> {
4 let cpu = CpuInfo::new()?;
5 let power = cpu.read()?;
6
7 println!("Package power:");
8 for (package, usage) in power.packages().enumerate() {
9 println!("\t#{}: {:.2}W", package, usage);
10 }
11 println!("Core power:");
12 for (core, usage) in power.cores().enumerate() {
13 println!("\t#{}: {:.2}W", core, usage);
14 }
15 Ok(())
16}Sourcepub fn packages<'a>(&'a self) -> impl Iterator<Item = f64> + 'a
pub fn packages<'a>(&'a self) -> impl Iterator<Item = f64> + 'a
Get an iterator for all cpu packages in the system and their power draw in watt
Examples found in repository?
examples/power.rs (line 8)
3fn main() -> Result<(), Error> {
4 let cpu = CpuInfo::new()?;
5 let power = cpu.read()?;
6
7 println!("Package power:");
8 for (package, usage) in power.packages().enumerate() {
9 println!("\t#{}: {:.2}W", package, usage);
10 }
11 println!("Core power:");
12 for (core, usage) in power.cores().enumerate() {
13 println!("\t#{}: {:.2}W", core, usage);
14 }
15 Ok(())
16}Trait Implementations§
Auto Trait Implementations§
impl Freeze for CpuPower
impl RefUnwindSafe for CpuPower
impl Send for CpuPower
impl Sync for CpuPower
impl Unpin for CpuPower
impl UnwindSafe for CpuPower
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