Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change collect_container_info to be a member of nano::block_processor #4434

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions nano/node/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,20 +412,20 @@ void nano::block_processor::queue_unchecked (store::write_transaction const & tr
node.unchecked.trigger (hash_or_account_a);
}

std::unique_ptr<nano::container_info_component> nano::collect_container_info (block_processor & block_processor, std::string const & name)
std::unique_ptr<nano::container_info_component> nano::block_processor::collect_container_info (std::string const & name)
{
std::size_t blocks_count;
std::size_t forced_count;

{
nano::lock_guard<nano::mutex> guard{ block_processor.mutex };
blocks_count = block_processor.blocks.size ();
forced_count = block_processor.forced.size ();
nano::lock_guard<nano::mutex> guard{ mutex };
blocks_count = blocks.size ();
forced_count = forced.size ();
}

auto composite = std::make_unique<container_info_composite> (name);
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "blocks", blocks_count, sizeof (decltype (block_processor.blocks)::value_type) }));
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "forced", forced_count, sizeof (decltype (block_processor.forced)::value_type) }));
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "blocks", blocks_count, sizeof (decltype (blocks)::value_type) }));
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "forced", forced_count, sizeof (decltype (forced)::value_type) }));
return composite;
}

Expand Down
3 changes: 1 addition & 2 deletions nano/node/blockprocessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class block_processor final
bool have_blocks_ready ();
bool have_blocks ();
void process_blocks ();
std::unique_ptr<container_info_component> collect_container_info (std::string const & name);

std::atomic<bool> flushing{ false };

Expand Down Expand Up @@ -110,7 +111,5 @@ class block_processor final
nano::condition_variable condition;
nano::mutex mutex{ mutex_identifier (mutexes::block_processor) };
std::thread processing_thread;

friend std::unique_ptr<container_info_component> collect_container_info (block_processor & block_processor, std::string const & name);
};
}
2 changes: 1 addition & 1 deletion nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ std::unique_ptr<nano::container_info_component> nano::collect_container_info (no
composite->add_component (collect_container_info (node.wallets, "wallets"));
composite->add_component (collect_container_info (node.vote_processor, "vote_processor"));
composite->add_component (collect_container_info (node.rep_crawler, "rep_crawler"));
composite->add_component (collect_container_info (node.block_processor, "block_processor"));
composite->add_component (node.block_processor.collect_container_info ("block_processor"));
composite->add_component (collect_container_info (node.online_reps, "online_reps"));
composite->add_component (collect_container_info (node.history, "history"));
composite->add_component (node.block_uniquer.collect_container_info ("block_uniquer"));
Expand Down
Loading