Skip to content

Commit

Permalink
Add 'Storage %' to 'histogram' command
Browse files Browse the repository at this point in the history
Summary: Add 'Storage %' to 'histogram' command to improve usability.

Reviewed By: pedroerp

Differential Revision: D58679579
  • Loading branch information
sdruzkin authored and facebook-github-bot committed Jun 19, 2024
1 parent 2c0be5b commit 2701bff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dwio/nimble/tools/NimbleDumpLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ void NimbleDumpLib::emitHistogram(
{"Data Type", 13, LEFT},
{"Compression", 15, LEFT},
{"Instance Count", 15, RIGHT},
{"Storage Bytes", 15, RIGHT}},
{"Storage Bytes", 15, RIGHT},
{"Storage %", 10, RIGHT}},
noHeader);

std::vector<
Expand All @@ -519,6 +520,7 @@ void NimbleDumpLib::emitHistogram(
rows.push_back(it);
}
std::sort(rows.begin(), rows.end(), HistogramRowCompare{});
auto fileSize = tablet_->fileSize();

for (const auto& it : rows) {
formatter.writeRow({
Expand All @@ -527,6 +529,7 @@ void NimbleDumpLib::emitHistogram(
it->first.compressinType ? toString(*it->first.compressinType) : "",
commaSeparated(it->second.count),
commaSeparated(it->second.bytes),
fmt::format("{:.{}f}", it->second.bytes * 100.0 / fileSize, 2),
});
}
}
Expand Down

0 comments on commit 2701bff

Please sign in to comment.