mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Make --profile-trace-path work without -p
This commit is contained in:
parent
82cc51280e
commit
c4f9576368
1 changed files with 32 additions and 31 deletions
|
@ -135,8 +135,7 @@ pub struct Profiler {
|
||||||
impl Profiler {
|
impl Profiler {
|
||||||
pub fn create(period: Option<f64>, file_path: Option<String>) -> ProfilerChan {
|
pub fn create(period: Option<f64>, file_path: Option<String>) -> ProfilerChan {
|
||||||
let (chan, port) = ipc::channel().unwrap();
|
let (chan, port) = ipc::channel().unwrap();
|
||||||
match period {
|
if let Some(period) = period {
|
||||||
Some(period) => {
|
|
||||||
let chan = chan.clone();
|
let chan = chan.clone();
|
||||||
spawn_named("Time profiler timer".to_owned(), move || {
|
spawn_named("Time profiler timer".to_owned(), move || {
|
||||||
loop {
|
loop {
|
||||||
|
@ -146,6 +145,9 @@ impl Profiler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if period.is_some() || file_path.is_some() {
|
||||||
// Spawn the time profiler.
|
// Spawn the time profiler.
|
||||||
spawn_named("Time profiler".to_owned(), move || {
|
spawn_named("Time profiler".to_owned(), move || {
|
||||||
let trace = file_path.as_ref()
|
let trace = file_path.as_ref()
|
||||||
|
@ -155,8 +157,7 @@ impl Profiler {
|
||||||
let mut profiler = Profiler::new(port, trace);
|
let mut profiler = Profiler::new(port, trace);
|
||||||
profiler.start();
|
profiler.start();
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
None => {
|
|
||||||
// No-op to handle messages when the time profiler is inactive.
|
// No-op to handle messages when the time profiler is inactive.
|
||||||
spawn_named("Time profiler".to_owned(), move || {
|
spawn_named("Time profiler".to_owned(), move || {
|
||||||
loop {
|
loop {
|
||||||
|
@ -167,7 +168,7 @@ impl Profiler {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
heartbeats::init();
|
heartbeats::init();
|
||||||
let profiler_chan = ProfilerChan(chan);
|
let profiler_chan = ProfilerChan(chan);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue