From 08df35537574d242f5f09b0f21eef14a5d0eb4ac Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 22 Dec 2019 14:17:31 +0100 Subject: More compact profiling display --- crates/ra_prof/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_prof/src') 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( total: Option, ) { let mut last = 0; - let indent = repeat(" ").take(lvl + 1).collect::(); + let indent = repeat(" ").take(lvl).collect::(); // We output hierarchy for long calls, but sum up all short calls let mut short = Vec::new(); let mut accounted_for = Duration::default(); @@ -227,7 +227,7 @@ fn print( } accounted_for += duration; if duration >= longer_than { - writeln!(out, "{} {:6}ms - {}", indent, duration.as_millis(), msg) + writeln!(out, "{}{:5}ms - {}", indent, duration.as_millis(), msg) .expect("printing profiling info to stdout"); print(lvl + 1, &msgs[last..i], out, longer_than, Some(duration)); @@ -245,14 +245,14 @@ fn print( count += 1; total_duration += *time; }); - writeln!(out, "{} {:6}ms - {} ({} calls)", indent, total_duration.as_millis(), msg, count) + writeln!(out, "{}{:5}ms - {} ({} calls)", indent, total_duration.as_millis(), msg, count) .expect("printing profiling info to stdout"); } if let Some(total) = total { if let Some(unaccounted) = total.checked_sub(accounted_for) { if unaccounted >= longer_than && last > 0 { - writeln!(out, "{} {:6}ms - ???", indent, unaccounted.as_millis()) + writeln!(out, "{}{:5}ms - ???", indent, unaccounted.as_millis()) .expect("printing profiling info to stdout"); } } -- cgit v1.2.3