From c1af21924623341babd7a840847141996ff35239 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Fri, 29 Nov 2024 01:51:33 -0500 Subject: [PATCH] progress: squeeze the progress table into 80 columns or less We don't need the subvol numbers since they're only interesting to developers. We don't need both max and min sizes, pick one and drop the other. Replace "16E" with "max"--it is the same number of characters, but doesn't require the user to know what 1<<64 is off the top of their head. Shorten "remain" to "todo" because sometimes those extra two columns matter. Drop the seconds field in ETA timestamps. Long scan arrival times are years away, and short scan arrival times are only updated once every 5 minutes, so the extra precision isn't useful. Signed-off-by: Zygo Blaxell --- src/bees-roots.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/bees-roots.cc b/src/bees-roots.cc index c2f0e3c..62cd1c0 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -1038,7 +1038,9 @@ BeesScanModeExtent::next_transid(const CrawlMap &crawl_map_unused) const auto time_so_far = now - min(now, this_state.m_started); string eta_stamp = "-"; string eta_pretty = "-"; - const bool finished = deferred_map.at(subvol).second; + const auto &deferred_finished = deferred_map.at(subvol); + const bool deferred = deferred_finished.first; + const bool finished = deferred_finished.second; if (time_so_far > 1 && bytenr_percent > 0 && !finished) { const time_t eta_duration = time_so_far / (bytenr_percent / 100); const time_t eta_time = eta_duration + now; @@ -1046,22 +1048,21 @@ BeesScanModeExtent::next_transid(const CrawlMap &crawl_map_unused) DIE_IF_ZERO(localtime_r(&eta_time, <m)); char buf[1024] = { 0 }; - DIE_IF_ZERO(strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", <m)); + DIE_IF_ZERO(strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", <m)); eta_stamp = string(buf); eta_pretty = pretty_seconds(eta_duration); } const auto &mma = mes.m_map.at(subvol); const auto mma_ratio = mes_sample_size_ok ? (mma.m_bytes / double(mes.m_total)) : 1.0; - const auto pos_text = Table::Text(deferred_map.at(subvol).first ? "deferred" : pretty(bytenr_offset * mma_ratio)); + const auto pos_scaled_text = mes_sample_size_ok ? pretty(bytenr_offset * mma_ratio) : "-"; + const auto pos_text = Table::Text(deferred ? "deferred" : pos_scaled_text); const auto pct_text = Table::Text(finished ? "finished" : astringprintf("%.4f%%", bytenr_percent)); const auto size_text = Table::Text( mes_sample_size_ok ? pretty(fs_size * mma_ratio) : "-"); eta.insert_row(Table::endpos, vector { pos_text, size_text, pct_text, - Table::Number(subvol), - Table::Text(pretty(magic.m_min_size & ~BLOCK_MASK_CLONE)), - Table::Text(pretty(magic.m_max_size)), + Table::Text(magic.m_max_size == numeric_limits::max() ? "max" : pretty(magic.m_max_size)), Table::Number(this_state.m_min_transid), Table::Number(this_state.m_max_transid), Table::Text(eta_pretty), @@ -1073,12 +1074,10 @@ BeesScanModeExtent::next_transid(const CrawlMap &crawl_map_unused) Table::Text("done"), Table::Text(pretty(fs_size)), Table::Text("%done"), - Table::Text("sub"), - Table::Text("szmn"), - Table::Text("szmx"), + Table::Text("size"), Table::Text("transid"), Table::Number(m_roots->transid_max()), - Table::Text("remain"), + Table::Text("todo"), Table::Text("ETA"), }); const auto dash_fill = Table::Fill('-');