Skip to content

Commit 9f616ed

Browse files
bors[bot]matklad
andauthored
Merge #2644
2644: More compact profiling display r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 parents db850cf + 08df355 commit 9f616ed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/ra_prof/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ fn print(
217217
total: Option<Duration>,
218218
) {
219219
let mut last = 0;
220-
let indent = repeat(" ").take(lvl + 1).collect::<String>();
220+
let indent = repeat(" ").take(lvl).collect::<String>();
221221
// We output hierarchy for long calls, but sum up all short calls
222222
let mut short = Vec::new();
223223
let mut accounted_for = Duration::default();
@@ -227,7 +227,7 @@ fn print(
227227
}
228228
accounted_for += duration;
229229
if duration >= longer_than {
230-
writeln!(out, "{} {:6}ms - {}", indent, duration.as_millis(), msg)
230+
writeln!(out, "{}{:5}ms - {}", indent, duration.as_millis(), msg)
231231
.expect("printing profiling info to stdout");
232232

233233
print(lvl + 1, &msgs[last..i], out, longer_than, Some(duration));
@@ -245,14 +245,14 @@ fn print(
245245
count += 1;
246246
total_duration += *time;
247247
});
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)
249249
.expect("printing profiling info to stdout");
250250
}
251251

252252
if let Some(total) = total {
253253
if let Some(unaccounted) = total.checked_sub(accounted_for) {
254254
if unaccounted >= longer_than && last > 0 {
255-
writeln!(out, "{} {:6}ms - ???", indent, unaccounted.as_millis())
255+
writeln!(out, "{}{:5}ms - ???", indent, unaccounted.as_millis())
256256
.expect("printing profiling info to stdout");
257257
}
258258
}

0 commit comments

Comments
 (0)