#cpu #amd #power #read #linux #cpu-info #ryzen

ryzen-reader

Read cpu power usage from AMD ryzen cpus on linux

2 releases

0.1.1 Aug 11, 2020
0.1.0 Aug 11, 2020

#3 in #ryzen

GPL-2.0+

11KB
170 lines

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.

Dependencies

~255–710KB
~17K SLoC