pub fn averages(&self) -> Vec<PerformanceAverage> {
    let mut averages: HashMap<String, Vec<Duration>> = HashMap::new();
    for measure in self.measures.lock().unwrap().iter() {
      averages
        .entry(measure.name.clone())
        .or_default()
        .push(measure.duration);
    }
    averages
      .into_iter()
      .map(|(k, d)| {
        let a = d.clone().into_iter().sum::<Duration>() / d.len() as u32;
        PerformanceAverage {
          name: k,
          count: d.len() as u32,
          average_duration: a.as_millis() as u32,
        }
      })
      .collect()
  }
/// Return an iterator which provides the names, count, and average duration
/// of each measurement.
Return an iterator which provides the names, count, and average duration
of each measurement.
Return an iterator which provides the names count and average duration of each measurement .
pub fn averages(&self) -> Vec<PerformanceAverage> {
    let mut averages: HashMap<String, Vec<Duration>> = HashMap::new();
    for measure in self.measures.lock().unwrap().iter() {
      averages
        .entry(measure.name.clone())
        .or_default()
        .push(measure.duration);
    }
    averages
      .into_iter()
      .map(|(k, d)| {
        let a = d.clone().into_iter().sum::<Duration>() / d.len() as u32;
        PerformanceAverage {
          name: k,
          count: d.len() as u32,
          average_duration: a.as_millis() as u32,
        }
      })
      .collect()
  }
pub fn averages ( & self ) -> Vec < PerformanceAverage > { let mut averages : HashMap < String , Vec < Duration > > = HashMap :: new ( ) ; for measure in self . measures . lock ( ) . unwrap ( ) . iter ( ) { averages . entry ( measure . name . clone ( ) ) . or_default ( ) . push ( measure . duration ) ; } averages . into_iter ( ) . map ( | ( k , d ) | { let a = d . clone ( ) . into_iter ( ) . sum :: < Duration > ( ) / d . len ( ) as u32 ; PerformanceAverage { name : k , count : d . len ( ) as u32 , average_duration : a . as_millis ( ) as u32 , } } ) . collect ( ) }
Return an iterator which provides the names, count, and average duration
of each measurement.
Return an iterator which provides the names count and average duration of each measurement .
&self
&self