mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add test for Profiler::get_statistics, and remove empty space around Profiler::get_statistics.
Profiler::get_statistics calculates mean, median, min, and max for a given vector of data. This commit adds a test for the calculated statistics.
This commit is contained in:
parent
6230911330
commit
d47b769cf7
2 changed files with 22 additions and 3 deletions
|
@ -327,8 +327,7 @@ impl Profiler {
|
|||
true
|
||||
}
|
||||
|
||||
|
||||
fn get_statistics(data: &[f64]) -> (f64, f64, f64, f64) {
|
||||
pub fn get_statistics(data: &[f64]) -> (f64, f64, f64, f64) {
|
||||
let data_len = data.len();
|
||||
let (mean, median, min, max) =
|
||||
(data.iter().sum::<f64>() / (data_len as f64),
|
||||
|
@ -338,7 +337,6 @@ impl Profiler {
|
|||
(mean, median, min, max)
|
||||
}
|
||||
|
||||
|
||||
fn print_buckets(&mut self) {
|
||||
match self.output {
|
||||
Some(OutputOptions::FileName(ref filename)) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue