Skip to content

Commit

Permalink
Merge pull request #363 from pepsiman/fix_diff_mode
Browse files Browse the repository at this point in the history
Fix TOTAL row and % column output in diff mode
  • Loading branch information
haberman authored Oct 2, 2023
2 parents 3925908 + f367183 commit 8be8b44
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bloaty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ class Rollup {
row->filtered_size.file = filtered_file_total_;
row->vmpercent = 100;
row->filepercent = 100;
if (base) {
row->size.vm -= base->vm_total_;
row->size.file -= base->file_total_;
}
output->diff_mode_ = true;
CreateRows(row, base, options, true);
}
Expand Down Expand Up @@ -399,8 +403,8 @@ void Rollup::CreateRows(RollupRow* row, const Rollup* base,
if (base) {
// For a diff, the percentage is a comparison against the previous size of
// the same label at the same level.
row->vmpercent = Percent(vm_total_, base->vm_total_);
row->filepercent = Percent(file_total_, base->file_total_);
row->vmpercent = Percent(vm_total_ - base->vm_total_, base->vm_total_);
row->filepercent = Percent(file_total_ - base->file_total_, base->file_total_);
}

for (const auto& value : children_) {
Expand Down

0 comments on commit 8be8b44

Please sign in to comment.