aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_prof/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-22 13:17:31 +0000
committerAleksey Kladov <[email protected]>2019-12-22 13:17:31 +0000
commit08df35537574d242f5f09b0f21eef14a5d0eb4ac (patch)
treebbb71537c3c45985d1e309f351ed598d9e21498e /crates/ra_prof/src
parent6acef5a7c088bcc1cdf8a64e28b8f20ddf9dcde7 (diff)
More compact profiling display
Diffstat (limited to 'crates/ra_prof/src')
-rw-r--r--crates/ra_prof/src/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs
index 845b2221c..f260c40a3 100644
--- a/crates/ra_prof/src/lib.rs
+++ b/crates/ra_prof/src/lib.rs
@@ -217,7 +217,7 @@ fn print(
217 total: Option<Duration>, 217 total: Option<Duration>,
218) { 218) {
219 let mut last = 0; 219 let mut last = 0;
220 let indent = repeat(" ").take(lvl + 1).collect::<String>(); 220 let indent = repeat(" ").take(lvl).collect::<String>();
221 // We output hierarchy for long calls, but sum up all short calls 221 // We output hierarchy for long calls, but sum up all short calls
222 let mut short = Vec::new(); 222 let mut short = Vec::new();
223 let mut accounted_for = Duration::default(); 223 let mut accounted_for = Duration::default();
@@ -227,7 +227,7 @@ fn print(
227 } 227 }
228 accounted_for += duration; 228 accounted_for += duration;
229 if duration >= longer_than { 229 if duration >= longer_than {
230 writeln!(out, "{} {:6}ms - {}", indent, duration.as_millis(), msg) 230 writeln!(out, "{}{:5}ms - {}", indent, duration.as_millis(), msg)
231 .expect("printing profiling info to stdout"); 231 .expect("printing profiling info to stdout");
232 232
233 print(lvl + 1, &msgs[last..i], out, longer_than, Some(duration)); 233 print(lvl + 1, &msgs[last..i], out, longer_than, Some(duration));
@@ -245,14 +245,14 @@ fn print(
245 count += 1; 245 count += 1;
246 total_duration += *time; 246 total_duration += *time;
247 }); 247 });
248 writeln!(out, "{} {:6}ms - {} ({} calls)", indent, total_duration.as_millis(), msg, count) 248 writeln!(out, "{}{:5}ms - {} ({} calls)", indent, total_duration.as_millis(), msg, count)
249 .expect("printing profiling info to stdout"); 249 .expect("printing profiling info to stdout");
250 } 250 }
251 251
252 if let Some(total) = total { 252 if let Some(total) = total {
253 if let Some(unaccounted) = total.checked_sub(accounted_for) { 253 if let Some(unaccounted) = total.checked_sub(accounted_for) {
254 if unaccounted >= longer_than && last > 0 { 254 if unaccounted >= longer_than && last > 0 {
255 writeln!(out, "{} {:6}ms - ???", indent, unaccounted.as_millis()) 255 writeln!(out, "{}{:5}ms - ???", indent, unaccounted.as_millis())
256 .expect("printing profiling info to stdout"); 256 .expect("printing profiling info to stdout");
257 } 257 }
258 } 258 }