From aa569a69291b29bfdb2d65f67381ffad16b31f7b Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 16 Dec 2025 14:20:23 -0500 Subject: [PATCH] Disable -w, change -t to wire size computation. --- console/executor_test_reader.cpp | 70 +++++++++++++++++--------------- console/executor_test_writer.cpp | 7 ++-- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/console/executor_test_reader.cpp b/console/executor_test_reader.cpp index 8ca9aff2..a3651587 100644 --- a/console/executor_test_reader.cpp +++ b/console/executor_test_reader.cpp @@ -31,6 +31,43 @@ using namespace network; using namespace system; // arbitrary testing (const). + +void executor::read_test(const hash_digest&) const +{ + logger("Wire size computation."); + const auto start = fine_clock::now(); + const auto last = metadata_.configured.node.maximum_height_(); + const auto concurrency = metadata_.configured.node.maximum_concurrency_(); + + size_t size{}; + for (auto height = zero; !cancel_ && height <= last; ++height) + { + const auto link = query_.to_candidate(height); + if (link.is_terminal()) + { + logger(format("Max candidate height is (%1%).") % sub1(height)); + return; + } + + const auto bytes = query_.get_block_size(link); + if (is_zero(bytes)) + { + logger(format("Block (%1%) is not associated.") % height); + return; + } + + size += bytes; + if (is_zero(height % concurrency)) + { + const auto span = duration_cast(fine_clock::now() - start); + logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") % + size % height % span.count()); + } + } +} + +#if defined(UNDEFINED) + void executor::read_test(const hash_digest&) const { logger(format("Point table body searches: %1% / (%2% + %1%)") % @@ -38,8 +75,6 @@ void executor::read_test(const hash_digest&) const store_.point.negative_search_count()); } -#if defined(UNDEFINED) - void executor::read_test(const hash_digest&) const { using namespace database; @@ -280,37 +315,6 @@ void executor::read_test(const hash_digest&) const query_.get_height(link)); } -void executor::read_test(const hash_digest&) const -{ - logger("Wire size computation."); - const auto start = fine_clock::now(); - const auto last = metadata_.configured.node.maximum_height; - - size_t size{}; - for (auto height = zero; !cancel_ && height <= last; ++height) - { - const auto link = query_.to_candidate(height); - if (link.is_terminal()) - { - logger(format("Max candidate height is (%1%).") % sub1(height)); - return; - } - - const auto bytes = query_.get_block_size(link); - if (is_zero(bytes)) - { - logger(format("Block (%1%) is not associated.") % height); - return; - } - - size += bytes; - } - - const auto span = duration_cast(fine_clock::now() - start); - logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") % - size % last % span.count()); -} - void executor::read_test(const hash_digest&) const { auto start = fine_clock::now(); diff --git a/console/executor_test_writer.cpp b/console/executor_test_writer.cpp index 35c48826..4e62edf7 100644 --- a/console/executor_test_writer.cpp +++ b/console/executor_test_writer.cpp @@ -29,14 +29,14 @@ using boost::format; using namespace network; using namespace system; -#if defined(UNDEFINED) - // arbitrary testing (non-const). void executor::write_test(const hash_digest&) { logger("No write test implemented."); } +#if defined(UNDEFINED) + void executor::write_test(const system::hash_digest&) { for (database::header_link link{ 793'008_u32 }; link < 885'000_u32; ++link) @@ -201,7 +201,6 @@ void executor::write_test(const system::hash_digest&) logger(format("block" BN_WRITE_ROW) % height % span.count()); } -#endif // UNDEFINED void executor::write_test(const system::hash_digest& hash) { @@ -221,5 +220,7 @@ void executor::write_test(const system::hash_digest& hash) } } +#endif // UNDEFINED + } // namespace node } // namespace libbitcoin