fn _frequencies() -> impl Iterator<Item = Result<CpuFrequency>> {
    // TODO: psutil looks into `/sys/devices/system/cpu/cpufreq/policy*` at first
    // But at my machine with Linux 5.0 `./cpu/cpu*/cpufreq` are symlinks to the `policy*`,
    // so at least we will cover most cases in first iteration and will fix weird values
    // later with the thoughts and patches

    // TODO: https://github.com/giampaolo/psutil/issues/1269
    let path = rt::linux::sysfs_root().join("devices/system/cpu/cpu[0-9]/cpufreq/");

    let entries = glob::glob(path.display().to_string().as_str()).expect("Incorrect glob pattern");

    entries.map(|try_path| {
        let path = try_path.map_err(|e| e.into_error())?;

        let current = current_freq(&path)?;
        let max = max_freq(&path);
        let min = min_freq(&path);

        Ok(CpuFrequency { current, max, min })
    })
}
/// Internal blocking iterator over CPU frequencies.
Internal blocking iterator over CPU frequencies.
Internal blocking iterator over CPU frequencies .
fn _frequencies() -> impl Iterator<Item = Result<CpuFrequency>> {
    // TODO: psutil looks into `/sys/devices/system/cpu/cpufreq/policy*` at first
    // But at my machine with Linux 5.0 `./cpu/cpu*/cpufreq` are symlinks to the `policy*`,
    // so at least we will cover most cases in first iteration and will fix weird values
    // later with the thoughts and patches
    // TODO: https://github.com/giampaolo/psutil/issues/1269
    let path = rt::linux::sysfs_root().join("devices/system/cpu/cpu[0-9]/cpufreq/");
    let entries = glob::glob(path.display().to_string().as_str()).expect("Incorrect glob pattern");
    entries.map(|try_path| {
        let path = try_path.map_err(|e| e.into_error())?;
        let current = current_freq(&path)?;
        let max = max_freq(&path);
        let min = min_freq(&path);
        Ok(CpuFrequency { current, max, min })
    })
}
fn _frequencies ( ) -> impl Iterator < Item = Result < CpuFrequency > > { // TODO: psutil looks into `/sys/devices/system/cpu/cpufreq/policy*` at first // But at my machine with Linux 5.0 `./cpu/cpu*/cpufreq` are symlinks to the `policy*`, // so at least we will cover most cases in first iteration and will fix weird values // later with the thoughts and patches // TODO: https://github.com/giampaolo/psutil/issues/1269 let path = rt :: linux :: sysfs_root ( ) . join ( " " ) ; let entries = glob :: glob ( path . display ( ) . to_string ( ) . as_str ( ) ) . expect ( " " ) ; entries . map ( | try_path | { let path = try_path . map_err ( | e | e . into_error ( ) ) ? ; let current = current_freq ( & path ) ? ; let max = max_freq ( & path ) ; let min = min_freq ( & path ) ; Ok ( CpuFrequency { current , max , min } ) } ) }
Internal blocking iterator over CPU frequencies.
Internal blocking iterator over CPU frequencies .