mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-17 02:08:30 +00:00
Merge #2644
2644: More compact profiling display r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
9f616ed65a
1 changed files with 4 additions and 4 deletions
|
@ -217,7 +217,7 @@ fn print(
|
|||
total: Option<Duration>,
|
||||
) {
|
||||
let mut last = 0;
|
||||
let indent = repeat(" ").take(lvl + 1).collect::<String>();
|
||||
let indent = repeat(" ").take(lvl).collect::<String>();
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue