Auto merge of #11119 - mbrubeck:trace-path, r=jdm

Make --profile-trace-path work without -p

Currently `--profile-trace-path` has no effect if `-p` isn't also passed, because the time profiler doesn't start.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11119)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-10 16:00:45 -07:00
commit 8fab68d6a9

View file

@ -135,8 +135,7 @@ pub struct Profiler {
impl Profiler {
pub fn create(period: Option<f64>, file_path: Option<String>) -> ProfilerChan {
let (chan, port) = ipc::channel().unwrap();
match period {
Some(period) => {
if let Some(period) = period {
let chan = chan.clone();
spawn_named("Time profiler timer".to_owned(), move || {
loop {
@ -146,6 +145,9 @@ impl Profiler {
}
}
});
}
if period.is_some() || file_path.is_some() {
// Spawn the time profiler.
spawn_named("Time profiler".to_owned(), move || {
let trace = file_path.as_ref()
@ -155,8 +157,7 @@ impl Profiler {
let mut profiler = Profiler::new(port, trace);
profiler.start();
});
}
None => {
} else {
// No-op to handle messages when the time profiler is inactive.
spawn_named("Time profiler".to_owned(), move || {
loop {
@ -167,7 +168,7 @@ impl Profiler {
}
});
}
}
heartbeats::init();
let profiler_chan = ProfilerChan(chan);