Skip to content

Commit

Permalink
Add 'Storage %' to 'histogram' command (#64)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #64

Add 'Storage %' to 'histogram' command to improve usability.

Reviewed By: pedroerp, helfman

Differential Revision: D58679579

fbshipit-source-id: 78d6ae3a63aaa47563aeabea06af80f04f5a66a3
  • Loading branch information
sdruzkin authored and facebook-github-bot committed Nov 28, 2024
1 parent 21d4e74 commit d66edc1
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 @@ -537,7 +537,8 @@ void NimbleDumpLib::emitHistogram(
{"Data Type", 13, Alignment::Left},
{"Compression", 15, Alignment::Left},
{"Instance Count", 15, Alignment::Right},
{"Storage Bytes", 15, Alignment::Right}},
{"Storage Bytes", 15, Alignment::Right},
{"Storage %", 10, Alignment::Right}},
noHeader);

std::vector<
Expand All @@ -548,6 +549,7 @@ void NimbleDumpLib::emitHistogram(
rows.push_back(it);
}
std::sort(rows.begin(), rows.end(), HistogramRowCompare{});
const auto fileSize = tabletReader.fileSize();

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

0 comments on commit d66edc1

Please sign in to comment.