From c22851b107f43dd6619b2399d9255ec4198ff05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Wed, 9 Oct 2024 23:35:28 +0200 Subject: [PATCH] Generated vote size histogram (#4751) --- nano/lib/stats_enums.hpp | 2 ++ nano/node/vote_generator.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nano/lib/stats_enums.hpp b/nano/lib/stats_enums.hpp index c8f3e5f81e..6bf38cd5ef 100644 --- a/nano/lib/stats_enums.hpp +++ b/nano/lib/stats_enums.hpp @@ -540,6 +540,8 @@ enum class sample active_election_duration, bootstrap_tag_duration, rep_response_time, + vote_generator_final_hashes, + vote_generator_hashes, _last // Must be the last enum }; diff --git a/nano/node/vote_generator.cpp b/nano/node/vote_generator.cpp index 00947ccec0..8166b8c305 100644 --- a/nano/node/vote_generator.cpp +++ b/nano/node/vote_generator.cpp @@ -124,15 +124,12 @@ void nano::vote_generator::process_batch (std::deque & batch) if (is_final) { transaction_variant_t transaction_variant{ ledger.tx_begin_write (nano::store::writer::voting_final) }; - verify_batch (transaction_variant, batch); - // Commit write transaction } else { transaction_variant_t transaction_variant{ ledger.tx_begin_read () }; - verify_batch (transaction_variant, batch); } @@ -208,9 +205,10 @@ void nano::vote_generator::broadcast (nano::unique_lock & lock_a) if (!hashes.empty ()) { lock_a.unlock (); - vote (hashes, roots, [this] (auto const & vote_a) { - this->broadcast_action (vote_a); - this->stats.inc (nano::stat::type::vote_generator, nano::stat::detail::generator_broadcasts); + vote (hashes, roots, [this] (auto const & generated_vote) { + stats.inc (nano::stat::type::vote_generator, nano::stat::detail::generator_broadcasts); + stats.sample (is_final ? nano::stat::sample::vote_generator_final_hashes : nano::stat::sample::vote_generator_hashes, generated_vote->hashes.size (), { 0, nano::network::confirm_ack_hashes_max }); + broadcast_action (generated_vote); }); lock_a.lock (); }