Skip to content

Commit

Permalink
Merge branch 'nanocurrency:develop' into cemented-observers-optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev authored May 25, 2024
2 parents 4204f98 + 51430f1 commit 4fe6e27
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 16 deletions.
3 changes: 3 additions & 0 deletions nano/lib/thread_roles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ std::string nano::thread_role::get_string (nano::thread_role::name role)
case nano::thread_role::name::io:
thread_role_name_string = "I/O";
break;
case nano::thread_role::name::io_daemon:
thread_role_name_string = "I/O (daemon)";
break;
case nano::thread_role::name::work:
thread_role_name_string = "Work pool";
break;
Expand Down
1 change: 1 addition & 0 deletions nano/lib/thread_roles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum class name
{
unknown,
io,
io_daemon,
work,
message_processing,
vote_processing,
Expand Down
2 changes: 1 addition & 1 deletion nano/nano_node/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag
logger.info (nano::log::type::daemon, "Start time: {:%c} UTC", fmt::gmtime (dateTime));

// IO context runner should be started first and stopped last to allow asio handlers to execute during node start/stop
runner = std::make_unique<nano::thread_runner> (io_ctx, logger, node->config.io_threads);
runner = std::make_unique<nano::thread_runner> (io_ctx, logger, node->config.io_threads, nano::thread_role::name::io_daemon);

node->start ();

Expand Down
2 changes: 1 addition & 1 deletion nano/nano_rpc/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void run (std::filesystem::path const & data_path, std::vector<std::string> cons

std::shared_ptr<boost::asio::io_context> io_ctx = std::make_shared<boost::asio::io_context> ();

runner = std::make_unique<nano::thread_runner> (io_ctx, logger, rpc_config.rpc_process.io_threads);
runner = std::make_unique<nano::thread_runner> (io_ctx, logger, rpc_config.rpc_process.io_threads, nano::thread_role::name::io_daemon);

try
{
Expand Down
2 changes: 1 addition & 1 deletion nano/nano_wallet/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, std::

std::shared_ptr<boost::asio::io_context> io_ctx = std::make_shared<boost::asio::io_context> ();

nano::thread_runner runner (io_ctx, logger, config.node.io_threads);
nano::thread_runner runner (io_ctx, logger, config.node.io_threads, nano::thread_role::name::io_daemon);

std::shared_ptr<nano::node> node;
std::shared_ptr<nano_qt::wallet> gui;
Expand Down
13 changes: 0 additions & 13 deletions nano/node/vote_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,8 @@ std::unique_ptr<nano::container_info_component> nano::vote_cache::collect_contai
{
nano::lock_guard<nano::mutex> guard{ mutex };

auto count_unique_votes = [this] () {
std::unordered_set<std::shared_ptr<nano::vote>> votes;
for (auto const & entry : cache)
{
for (auto const & vote : entry.votes ())
{
votes.insert (vote);
}
}
return votes.size ();
};

auto composite = std::make_unique<container_info_composite> (name);
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "cache", cache.size (), sizeof (ordered_cache::value_type) }));
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "unique", count_unique_votes (), sizeof (nano::vote) }));
return composite;
}

Expand Down

0 comments on commit 4fe6e27

Please sign in to comment.