/// `percentile` returns the percentile value for the histogram.
/// value of p should be between [0.0-1.0]
`percentile` returns the percentile value for the histogram.
` percentile ` returns the percentile value for the histogram .
pub fn percentile(&self, p: f64) -> f64 {
        let count = self.count.load(Ordering::SeqCst);
        if count == 0 {
            // if no data return the minimum range
            self.bounds[0].load(Ordering::SeqCst)
        } else {
            let mut pval = ((count as f64) * p) as i64;
            for (idx, val) in self.count_per_bucket.iter().enumerate() {
                pval -= val.load(Ordering::SeqCst);
                if pval <= 0 {
                    if idx == self.bounds.len() {
                        break;
                    }
                    return self.bounds[idx].load(Ordering::SeqCst);
                }
            }
            // default return should be the max range
            self.bounds[self.bounds.len() - 1].load(Ordering::SeqCst)
        }
    }
pub fn percentile ( & self , p : f64 ) -> f64 { let count = self . count . load ( Ordering :: SeqCst ) ; if count == 0 { // if no data return the minimum range self . bounds [ 0 ] . load ( Ordering :: SeqCst ) } else { let mut pval = ( ( count as f64 ) * p ) as i64 ; for ( idx , val ) in self . count_per_bucket . iter ( ) . enumerate ( ) { pval -= val . load ( Ordering :: SeqCst ) ; if pval <= 0 { if idx == self . bounds . len ( ) { break ; } return self . bounds [ idx ] . load ( Ordering :: SeqCst ) ; } } // default return should be the max range self . bounds [ self . bounds . len ( ) - 1 ] . load ( Ordering :: SeqCst ) } }
`percentile` returns the percentile value for the histogram.
` percentile ` returns the percentile value for the histogram .
&self
p
f64