pub fn read_stats(&self) -> Option<CPUStat> {
        let mut stats = CPUStat {
            cputime: CpuTime {
                user: 0.0,
                nice: 0.0,
                system: 0.0,
                idle: 0.0,
                iowait: Some(0.0),
                irq: Some(0.0),
                softirq: Some(0.0),
                guest: Some(0.0),
                guest_nice: Some(0.0),
                steal: Some(0.0),
            },
        };
        for c in &self.cpu_cores {
            let c_stats = c.read_stats().unwrap();
            stats.cputime.user += c_stats.user;
            stats.cputime.nice += c_stats.nice;
            stats.cputime.system += c_stats.system;
            stats.cputime.idle += c_stats.idle;
            stats.cputime.iowait =
                Some(stats.cputime.iowait.unwrap_or_default() + c_stats.iowait.unwrap_or_default());
            stats.cputime.irq =
                Some(stats.cputime.irq.unwrap_or_default() + c_stats.irq.unwrap_or_default());
            stats.cputime.softirq = Some(
                stats.cputime.softirq.unwrap_or_default() + c_stats.softirq.unwrap_or_default(),
            );
        }
        Some(stats)
    }
/// Combines stats from all CPU cores owned byu the socket and returns
/// a CpuTime struct containing stats for the whole socket.
Combines stats from all CPU cores owned byu the socket and returns
a CpuTime struct containing stats for the whole socket.
Combines stats from all CPU cores owned byu the socket and returns a CpuTime struct containing stats for the whole socket .
pub fn read_stats(&self) -> Option<CPUStat> {
        let mut stats = CPUStat {
            cputime: CpuTime {
                user: 0.0,
                nice: 0.0,
                system: 0.0,
                idle: 0.0,
                iowait: Some(0.0),
                irq: Some(0.0),
                softirq: Some(0.0),
                guest: Some(0.0),
                guest_nice: Some(0.0),
                steal: Some(0.0),
            },
        };
        for c in &self.cpu_cores {
            let c_stats = c.read_stats().unwrap();
            stats.cputime.user += c_stats.user;
            stats.cputime.nice += c_stats.nice;
            stats.cputime.system += c_stats.system;
            stats.cputime.idle += c_stats.idle;
            stats.cputime.iowait =
                Some(stats.cputime.iowait.unwrap_or_default() + c_stats.iowait.unwrap_or_default());
            stats.cputime.irq =
                Some(stats.cputime.irq.unwrap_or_default() + c_stats.irq.unwrap_or_default());
            stats.cputime.softirq = Some(
                stats.cputime.softirq.unwrap_or_default() + c_stats.softirq.unwrap_or_default(),
            );
        }
        Some(stats)
    }
pub fn read_stats ( & self ) -> Option < CPUStat > { let mut stats = CPUStat { cputime : CpuTime { user : 0.0 , nice : 0.0 , system : 0.0 , idle : 0.0 , iowait : Some ( 0.0 ) , irq : Some ( 0.0 ) , softirq : Some ( 0.0 ) , guest : Some ( 0.0 ) , guest_nice : Some ( 0.0 ) , steal : Some ( 0.0 ) , } , } ; for c in & self . cpu_cores { let c_stats = c . read_stats ( ) . unwrap ( ) ; stats . cputime . user += c_stats . user ; stats . cputime . nice += c_stats . nice ; stats . cputime . system += c_stats . system ; stats . cputime . idle += c_stats . idle ; stats . cputime . iowait = Some ( stats . cputime . iowait . unwrap_or_default ( ) + c_stats . iowait . unwrap_or_default ( ) ) ; stats . cputime . irq = Some ( stats . cputime . irq . unwrap_or_default ( ) + c_stats . irq . unwrap_or_default ( ) ) ; stats . cputime . softirq = Some ( stats . cputime . softirq . unwrap_or_default ( ) + c_stats . softirq . unwrap_or_default ( ) , ) ; } Some ( stats ) }
Combines stats from all CPU cores owned byu the socket and returns
a CpuTime struct containing stats for the whole socket.
Combines stats from all CPU cores owned byu the socket and returns a CpuTime struct containing stats for the whole socket .
&self
&self