aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_prof/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-22 13:48:43 +0000
committerGitHub <[email protected]>2019-12-22 13:48:43 +0000
commit9f616ed65a3cd3088a006ab9f116c2b9a2235cb6 (patch)
treebbb71537c3c45985d1e309f351ed598d9e21498e /crates/ra_prof/src
parentdb850cf976ff2d291fecab8c1b5b876f4c747dc0 (diff)
parent08df35537574d242f5f09b0f21eef14a5d0eb4ac (diff)
Merge #2644
2644: More compact profiling display r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
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 }