Skip to content

Commit

Permalink
Generated vote size histogram (#4751)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev authored Oct 9, 2024
1 parent 75bee94 commit c22851b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions nano/lib/stats_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
10 changes: 4 additions & 6 deletions nano/node/vote_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,12 @@ void nano::vote_generator::process_batch (std::deque<queue_entry_t> & 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);
}

Expand Down Expand Up @@ -208,9 +205,10 @@ void nano::vote_generator::broadcast (nano::unique_lock<nano::mutex> & 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 ();
}
Expand Down

0 comments on commit c22851b

Please sign in to comment.