Skip to content

Commit

Permalink
os/bluestore: beautify disk size output for volume selector
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
  • Loading branch information
ifed01 committed Feb 9, 2023
1 parent 4f20521 commit 326eabe
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -18099,11 +18099,8 @@ void* RocksDBBlueFSVolumeSelector::get_hint_by_dir(std::string_view dirname) con
void RocksDBBlueFSVolumeSelector::dump(ostream& sout) {
auto max_x = per_level_per_dev_usage.get_max_x();
auto max_y = per_level_per_dev_usage.get_max_y();
sout << "RocksDBBlueFSVolumeSelector: wal_total:" << l_totals[LEVEL_WAL - LEVEL_FIRST]
<< ", db_total:" << l_totals[LEVEL_DB - LEVEL_FIRST]
<< ", slow_total:" << l_totals[LEVEL_SLOW - LEVEL_FIRST]
<< ", db_avail:" << db_avail4slow << std::endl
<< "Usage matrix:" << std::endl;

sout << "RocksDBBlueFSVolumeSelector Usage Matrix:" << std::endl;
constexpr std::array<const char*, 8> names{ {
"DEV/LEV",
"WAL",
Expand Down Expand Up @@ -18134,7 +18131,7 @@ void RocksDBBlueFSVolumeSelector::dump(ostream& sout) {
case LEVEL_SLOW:
sout << "SLOW"; break;
case LEVEL_MAX:
sout << "TOTALS"; break;
sout << "TOTAL"; break;
}
for (size_t d = 0; d < max_x; d++) {
sout.setf(std::ios::left, std::ios::adjustfield);
Expand All @@ -18161,7 +18158,7 @@ void RocksDBBlueFSVolumeSelector::dump(ostream& sout) {
case LEVEL_SLOW:
sout << "SLOW"; break;
case LEVEL_MAX:
sout << "TOTALS"; break;
sout << "TOTAL"; break;
}
for (size_t d = 0; d < max_x - 1; d++) {
sout.setf(std::ios::left, std::ios::adjustfield);
Expand All @@ -18171,10 +18168,20 @@ void RocksDBBlueFSVolumeSelector::dump(ostream& sout) {
sout.setf(std::ios::left, std::ios::adjustfield);
sout.width(width);
sout << stringify(byte_u_t(per_level_per_dev_max.at(max_x - 1, l)));
if (l < max_y - 1) {
sout << std::endl;
}
sout << std::endl;
}
string sizes[] = {
">> SIZE <<",
stringify(byte_u_t(l_totals[LEVEL_WAL - LEVEL_FIRST])),
stringify(byte_u_t(l_totals[LEVEL_DB - LEVEL_FIRST])),
stringify(byte_u_t(l_totals[LEVEL_SLOW - LEVEL_FIRST])),
};
for (size_t i = 0; i < (sizeof(sizes) / sizeof(sizes[0])); i++) {
sout.setf(std::ios::left, std::ios::adjustfield);
sout.width(width);
sout << sizes[i];
}
sout << std::endl;
}

BlueFSVolumeSelector* RocksDBBlueFSVolumeSelector::clone_empty() const {
Expand Down

0 comments on commit 326eabe

Please sign in to comment.