ryzen-reader

Crates.ioryzen-reader
lib.rsryzen-reader
version0.1.1
sourcesrc
created_at2020-08-11 20:10:32.397668
updated_at2020-08-11 20:32:07.891674
descriptionRead cpu power usage from AMD ryzen cpus on linux
homepage
repositoryhttps://github.com/icewind1991/ryzen-reader
max_upload_size
id275478
size28,377
Robin Appelman (icewind1991)

documentation

https://docs.rs/ryzen-reader

README

ryzer-reader

Read cpu power usage from AMD ryzen cpus on linux

Example

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(())
}

Credits

This code is largely based on rapl-read-ryzen and all credits on how to read the values goes to it's author.

Commit count: 7

cargo fmt