Format remaining files

This commit is contained in:
Pyfisch 2018-11-06 13:01:35 +01:00
parent bf47f90da6
commit cb07debcb6
252 changed files with 5944 additions and 3744 deletions

View file

@ -184,7 +184,8 @@ impl Profiler {
let trace = file_path.as_ref().and_then(|p| TraceDump::new(p).ok());
let mut profiler = Profiler::new(port, trace, Some(outputoption));
profiler.start();
}).expect("Thread spawning failed");
})
.expect("Thread spawning failed");
// decide if we need to spawn the timer thread
match option {
&OutputOptions::FileName(_) | &OutputOptions::DB(_, _, _, _) => {
@ -200,7 +201,8 @@ impl Profiler {
if chan.send(ProfilerMsg::Print).is_err() {
break;
}
}).expect("Thread spawning failed");
})
.expect("Thread spawning failed");
},
}
},
@ -214,7 +216,8 @@ impl Profiler {
let trace = file_path.as_ref().and_then(|p| TraceDump::new(p).ok());
let mut profiler = Profiler::new(port, trace, None);
profiler.start();
}).expect("Thread spawning failed");
})
.expect("Thread spawning failed");
} else {
// No-op to handle messages when the time profiler is not printing:
thread::Builder::new()
@ -228,7 +231,8 @@ impl Profiler {
},
_ => {},
}
}).expect("Thread spawning failed");
})
.expect("Thread spawning failed");
}
},
}
@ -281,7 +285,8 @@ impl Profiler {
start_time = end_time;
start_energy = end_energy;
}
}).expect("Thread spawning failed");
})
.expect("Thread spawning failed");
}
profiler_chan
@ -323,9 +328,11 @@ impl Profiler {
let ms = (t.1 - t.0) as f64 / 1000000f64;
self.find_or_insert(k, ms);
},
ProfilerMsg::Print => if let Some(ProfilerMsg::Time(..)) = self.last_msg {
// only print if more data has arrived since the last printout
self.print_buckets();
ProfilerMsg::Print => {
if let Some(ProfilerMsg::Time(..)) = self.last_msg {
// only print if more data has arrived since the last printout
self.print_buckets();
}
},
ProfilerMsg::Get(k, sender) => {
let vec_option = self.buckets.get(&k);
@ -381,7 +388,8 @@ impl Profiler {
file,
"_category_\t_incremental?_\t_iframe?_\t_url_\t_mean (ms)_\t\
_median (ms)_\t_min (ms)_\t_max (ms)_\t_events_\n"
).unwrap();
)
.unwrap();
for (&(ref category, ref meta), ref mut data) in &mut self.buckets {
data.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values in profiles"));
let data_len = data.len();
@ -397,7 +405,8 @@ impl Profiler {
min,
max,
data_len
).unwrap();
)
.unwrap();
}
}
},
@ -417,7 +426,8 @@ impl Profiler {
" _min (ms)_",
" _max (ms)_",
" _events_"
).unwrap();
)
.unwrap();
for (&(ref category, ref meta), ref mut data) in &mut self.buckets {
data.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values in profiles"));
let data_len = data.len();
@ -433,7 +443,8 @@ impl Profiler {
min,
max,
data_len
).unwrap();
)
.unwrap();
}
}
writeln!(&mut lock, "").unwrap();
@ -473,8 +484,9 @@ impl Profiler {
measurement.add_tag("host", meta.url.as_str());
};
tokio::run(client.write_one(measurement, None)
.map_err(|e| warn!("Could not write measurement to profiler db: {:?}", e)));
tokio::run(client.write_one(measurement, None).map_err(|e| {
warn!("Could not write measurement to profiler db: {:?}", e)
}));
}
}
},