Crates.io | ryzen-reader |
lib.rs | ryzen-reader |
version | 0.1.1 |
source | src |
created_at | 2020-08-11 20:10:32.397668 |
updated_at | 2020-08-11 20:32:07.891674 |
description | Read cpu power usage from AMD ryzen cpus on linux |
homepage | |
repository | https://github.com/icewind1991/ryzen-reader |
max_upload_size | |
id | 275478 |
size | 28,377 |
Read cpu power usage from AMD ryzen cpus on linux
use ryzen_reader::{CpuInfo, Error};
fn main() -> Result<(), Error> {
let cpu = CpuInfo::new()?;
let power = cpu.read()?;
println!("Package power:");
for (package, usage) in power.packages().enumerate() {
println!("\t#{}: {:.2}W", package, usage);
}
println!("Core power:");
for (core, usage) in power.cores().enumerate() {
println!("\t#{}: {:.2}W", core, usage);
}
Ok(())
}
This code is largely based on rapl-read-ryzen and all credits on how to read the values goes to it's author.