/// Compare this processes cpu utilization since the process representing th start time
///
/// The passed-in `start_process` is the time that we are comparing
/// against: `self` should be newer.
///
/// The `total_cpu` is how many Jiffies have passed on the cpu over the
/// same time period.
///
/// # Panics
/// If the total_cpu on start_process is higher than the total_cpu on current.
Compare this processes cpu utilization since the process representing th start time
The passed-in `start_process` is the time that we are comparing
against: `self` should be newer.

The `total_cpu` is how many Jiffies have passed on the cpu over the
same time period.
Compare this processes cpu utilization since the process representing th start time The passed - in ` start_process ` is the time that we are comparing against : ` self ` should be newer . The ` total_cpu ` is how many Jiffies have passed on the cpu over the same time period .
pub fn cpu_utilization_since<'a>(
        &'a self,
        start_process: &'a Process,
        total_cpu: Jiffies,
    ) -> ProcessCpuUsage<'a> {
        let (start_ps, end_ps) = (&start_process.stat, &self.stat);
        if end_ps.utime < start_ps.utime || end_ps.stime < start_ps.stime {
            panic!("End process is before start process (arguments called in wrong order)");
        }
        let user = 100.0
            * (end_ps.utime - start_ps.utime)
                .duration()
                .ratio(&total_cpu.duration());
        let sys = 100.0
            * (end_ps.stime - start_ps.stime)
                .duration()
                .ratio(&total_cpu.duration());
        ProcessCpuUsage {
            process: &start_process,
            upercent: user,
            spercent: sys,
            total: user + sys,
        }
    }
pub fn cpu_utilization_since < ' a > ( & ' a self , start_process : & ' a Process , total_cpu : Jiffies , ) -> ProcessCpuUsage < ' a > { let ( start_ps , end_ps ) = ( & start_process . stat , & self . stat ) ; if end_ps . utime < start_ps . utime || end_ps . stime < start_ps . stime { panic ! ( " " ) ; } let user = 100.0 * ( end_ps . utime - start_ps . utime ) . duration ( ) . ratio ( & total_cpu . duration ( ) ) ; let sys = 100.0 * ( end_ps . stime - start_ps . stime ) . duration ( ) . ratio ( & total_cpu . duration ( ) ) ; ProcessCpuUsage { process : & start_process , upercent : user , spercent : sys , total : user + sys , } }
Compare this processes cpu utilization since the process representing th start time
The passed-in `start_process` is the time that we are comparing
against: `self` should be newer.
Compare this processes cpu utilization since the process representing th start time The passed - in ` start_process ` is the time that we are comparing against : ` self ` should be newer .
&'a self
start_process
&'a Process
total_cpu
Jiffies
panics
If the total_cpu on start_process is higher than the total_cpu on current.
If the total_cpu on start_process is higher than the total_cpu on current .