Skip to content

Commit 3c24fea

Browse files
author
Matthew Hammer
committed
-Z profile-queries: remove panic when channel is unset
1 parent 28cb03d commit 3c24fea

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

src/librustc/util/common.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ pub fn profq_msg(msg: ProfileQueriesMsg) {
7575
if let Some(s) = sender.borrow().as_ref() {
7676
s.send(msg).unwrap()
7777
} else {
78-
panic!("no channel on which to send profq_msg: {:?}", msg)
78+
// Do nothing.
79+
//
80+
// FIXME(matthewhammer): Multi-threaded translation phase triggers the panic below.
81+
// From backtrace: rustc_trans::back::write::spawn_work::{{closure}}.
82+
//
83+
// panic!("no channel on which to send profq_msg: {:?}", msg)
7984
}
8085
})
8186
}

src/librustc_driver/profile/trace.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,15 @@ fn write_traces_rec(file: &mut File, traces: &Vec<Rec>, total: Duration, depth:
137137
fn compute_counts_rec(counts: &mut HashMap<String,QueryMetric>, traces: &Vec<Rec>) {
138138
for t in traces.iter() {
139139
match t.effect {
140-
Effect::TimeBegin(ref _msg) => {
141-
// dont count time-begin effects
142-
}
140+
Effect::TimeBegin(ref msg) => {
141+
let qm = match counts.get(msg) {
142+
Some(_qm) => { panic!("TimeBegin with non-unique, repeat message") }
143+
None => QueryMetric{
144+
count: 1,
145+
duration: t.duration
146+
}};
147+
counts.insert(msg.clone(), qm);
148+
},
143149
Effect::QueryBegin(ref qmsg, ref _cc) => {
144150
let qcons = cons_of_query_msg(qmsg);
145151
let qm = match counts.get(&qcons) {
@@ -239,29 +245,29 @@ body {
239245
display: none
240246
}
241247
.frac-50 {
242-
padding: 4px;
248+
padding: 10px;
243249
border-width: 10px;
244-
font-size: 16px;
250+
font-size: 32px;
245251
}
246252
.frac-40 {
247-
padding: 4px;
253+
padding: 8px;
248254
border-width: 8px;
249-
font-size: 16px;
255+
font-size: 24px;
250256
}
251257
.frac-30 {
252-
padding: 3px;
258+
padding: 6px;
253259
border-width: 6px;
254-
font-size: 16px;
260+
font-size: 18px;
255261
}
256262
.frac-20 {
257-
padding: 3px;
263+
padding: 4px;
258264
border-width: 6px;
259265
font-size: 16px;
260266
}
261267
.frac-10 {
262-
padding: 3px;
268+
padding: 2px;
263269
border-width: 6px;
264-
font-size: 16px;
270+
font-size: 14px;
265271
}
266272
").unwrap();
267273
}

0 commit comments

Comments
 (0)