Skip to content

Commit

Permalink
-Z profile-queries: remove panic when channel is unset
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hammer committed Aug 23, 2017
1 parent 28cb03d commit 3c24fea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/librustc/util/common.rs
Expand Up @@ -75,7 +75,12 @@ pub fn profq_msg(msg: ProfileQueriesMsg) {
if let Some(s) = sender.borrow().as_ref() {
s.send(msg).unwrap()
} else {
panic!("no channel on which to send profq_msg: {:?}", msg)
// Do nothing.
//
// FIXME(matthewhammer): Multi-threaded translation phase triggers the panic below.
// From backtrace: rustc_trans::back::write::spawn_work::{{closure}}.
//
// panic!("no channel on which to send profq_msg: {:?}", msg)
}
})
}
Expand Down
30 changes: 18 additions & 12 deletions src/librustc_driver/profile/trace.rs
Expand Up @@ -137,9 +137,15 @@ fn write_traces_rec(file: &mut File, traces: &Vec<Rec>, total: Duration, depth:
fn compute_counts_rec(counts: &mut HashMap<String,QueryMetric>, traces: &Vec<Rec>) {
for t in traces.iter() {
match t.effect {
Effect::TimeBegin(ref _msg) => {
// dont count time-begin effects
}
Effect::TimeBegin(ref msg) => {
let qm = match counts.get(msg) {
Some(_qm) => { panic!("TimeBegin with non-unique, repeat message") }
None => QueryMetric{
count: 1,
duration: t.duration
}};
counts.insert(msg.clone(), qm);
},
Effect::QueryBegin(ref qmsg, ref _cc) => {
let qcons = cons_of_query_msg(qmsg);
let qm = match counts.get(&qcons) {
Expand Down Expand Up @@ -239,29 +245,29 @@ body {
display: none
}
.frac-50 {
padding: 4px;
padding: 10px;
border-width: 10px;
font-size: 16px;
font-size: 32px;
}
.frac-40 {
padding: 4px;
padding: 8px;
border-width: 8px;
font-size: 16px;
font-size: 24px;
}
.frac-30 {
padding: 3px;
padding: 6px;
border-width: 6px;
font-size: 16px;
font-size: 18px;
}
.frac-20 {
padding: 3px;
padding: 4px;
border-width: 6px;
font-size: 16px;
}
.frac-10 {
padding: 3px;
padding: 2px;
border-width: 6px;
font-size: 16px;
font-size: 14px;
}
").unwrap();
}

0 comments on commit 3c24fea

Please sign in to comment.