pub fn measure(&mut self) -> Option<&Measurement> {
        if self.task.handle_is_invalid() {
            if self.should_drop_old_measurements {
                self.measurements.pop_front();
            } else {
                self.post_invalidation_measurements += 1;
                self.should_drop_old_measurements = self.post_invalidation_measurements
                    + self.measurements.len()
                    >= COMPONENT_CPU_MAX_SAMPLES;
            }
            return None;
        }
        if let Ok(runtime_info) = self.task.get_runtime_info() {
            let measurement = runtime_info.into();
            self.measurements.insert(measurement);
            return self.measurements.back();
        }
        None
    }
/// Take a new measurement. If the handle of this task is invalid, then it keeps track of how
/// many measurements would have been done. When the maximum amount allowed is hit, then it
/// drops the oldest measurement.
Take a new measurement. If the handle of this task is invalid, then it keeps track of how
many measurements would have been done. When the maximum amount allowed is hit, then it
drops the oldest measurement.
Take a new measurement . If the handle of this task is invalid then it keeps track of how many measurements would have been done . When the maximum amount allowed is hit then it drops the oldest measurement .
pub fn measure(&mut self) -> Option<&Measurement> {
        if self.task.handle_is_invalid() {
            if self.should_drop_old_measurements {
                self.measurements.pop_front();
            } else {
                self.post_invalidation_measurements += 1;
                self.should_drop_old_measurements = self.post_invalidation_measurements
                    + self.measurements.len()
                    >= COMPONENT_CPU_MAX_SAMPLES;
            }
            return None;
        }
        if let Ok(runtime_info) = self.task.get_runtime_info() {
            let measurement = runtime_info.into();
            self.measurements.insert(measurement);
            return self.measurements.back();
        }
        None
    }
pub fn measure ( & mut self ) -> Option < & Measurement > { if self . task . handle_is_invalid ( ) { if self . should_drop_old_measurements { self . measurements . pop_front ( ) ; } else { self . post_invalidation_measurements += 1 ; self . should_drop_old_measurements = self . post_invalidation_measurements + self . measurements . len ( ) >= COMPONENT_CPU_MAX_SAMPLES ; } return None ; } if let Ok ( runtime_info ) = self . task . get_runtime_info ( ) { let measurement = runtime_info . into ( ) ; self . measurements . insert ( measurement ) ; return self . measurements . back ( ) ; } None }
Take a new measurement.
Take a new measurement .
&mut self
&mut self