Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When printing binary stats diff, combine all unchanged rows into one #1844

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions collector/src/bin/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,30 @@ fn print_binary_stats(
}
}
rows.sort_by_cached_key(|row| Reverse((row.diff.abs(), row.before, row.name.clone())));

// Combine all unchanged rows into one.
if use_diff {
let mut unchanged_count = 0;
let mut total_unchanged = 0;
rows.retain(|row| {
if row.diff == 0 {
unchanged_count += 1;
total_unchanged += row.before;
false
} else {
true
}
});
if total_unchanged > 0 {
rows.push(Row {
name: format!("<{unchanged_count} unchanged rows>"),
before: total_unchanged,
after: total_unchanged,
diff: 0,
});
}
}

rows.push(Row {
name: "Total".to_string(),
before: total_before,
Expand Down
Loading