summaryrefslogtreecommitdiffstats
path: root/src/app/data_harvester/cpu/heim/unix.rs
blob: 74340951a342f7b00c1f6f34b02c0a7380978336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Unix-specific functions regarding CPU usage.

use crate::app::data_harvester::cpu::LoadAvgHarvest;

pub async fn get_load_avg() -> crate::error::Result<LoadAvgHarvest> {
    let (one, five, fifteen) = heim::cpu::os::unix::loadavg().await?;

    Ok([
        one.get::<heim::units::ratio::ratio>(),
        five.get::<heim::units::ratio::ratio>(),
        fifteen.get::<heim::units::ratio::ratio>(),
    ])
}