Skip to content

Commit

Permalink
Renaming scheduler threads to match how components are organized in t…
Browse files Browse the repository at this point in the history
…he scheduler namespace
  • Loading branch information
clemahieu committed Sep 12, 2023
1 parent 1fd99a6 commit 7abb90b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
21 changes: 12 additions & 9 deletions nano/lib/thread_roles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,12 @@ std::string nano::thread_role::get_string (nano::thread_role::name role)
case nano::thread_role::name::db_parallel_traversal:
thread_role_name_string = "DB par traversl";
break;
case nano::thread_role::name::election_scheduler:
thread_role_name_string = "Election Sched";
break;
case nano::thread_role::name::unchecked:
thread_role_name_string = "Unchecked";
break;
case nano::thread_role::name::backlog_population:
thread_role_name_string = "Backlog";
break;
case nano::thread_role::name::election_hinting:
thread_role_name_string = "Hinting";
break;
case nano::thread_role::name::vote_generator_queue:
thread_role_name_string = "Voting que";
break;
Expand All @@ -94,8 +88,17 @@ std::string nano::thread_role::get_string (nano::thread_role::name role)
case nano::thread_role::name::telemetry:
thread_role_name_string = "Telemetry";
break;
case nano::thread_role::name::optimistic_scheduler:
thread_role_name_string = "Optimistic";
case nano::thread_role::name::scheduler_hinted:
thread_role_name_string = "Sched Hinted";
break;
case nano::thread_role::name::scheduler_manual:
thread_role_name_string = "Sched Manual";
break;
case nano::thread_role::name::scheduler_optimistic:
thread_role_name_string = "Sched Opt";
break;
case nano::thread_role::name::scheduler_priority:
thread_role_name_string = "Sched Priority";
break;
default:
debug_assert (false && "nano::thread_role::get_string unhandled thread role");
Expand Down Expand Up @@ -133,4 +136,4 @@ void nano::thread_role::set (nano::thread_role::name role)
nano::thread_role::set_os_name (thread_role_name_string);

current_thread_role = role;
}
}
9 changes: 5 additions & 4 deletions nano/lib/thread_roles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ enum class name
state_block_signature_verification,
epoch_upgrader,
db_parallel_traversal,
election_scheduler,
unchecked,
backlog_population,
election_hinting,
vote_generator_queue,
bootstrap_server,
telemetry,
optimistic_scheduler,
ascending_bootstrap,
bootstrap_server_requests,
bootstrap_server_responses,
scheduler_hinted,
scheduler_manual,
scheduler_optimistic,
scheduler_priority,
};

/*
Expand All @@ -63,4 +64,4 @@ std::string get_string ();
* Internal only, should not be called directly
*/
void set_os_name (std::string const &);
}
}
2 changes: 1 addition & 1 deletion nano/node/scheduler/hinted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void nano::scheduler::hinted::start ()
debug_assert (!thread.joinable ());

thread = std::thread{ [this] () {
nano::thread_role::set (nano::thread_role::name::election_hinting);
nano::thread_role::set (nano::thread_role::name::scheduler_hinted);
run ();
} };
}
Expand Down
2 changes: 1 addition & 1 deletion nano/node/scheduler/manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void nano::scheduler::manual::start ()
debug_assert (!thread.joinable ());

thread = std::thread{ [this] () {
nano::thread_role::set (nano::thread_role::name::election_scheduler);
nano::thread_role::set (nano::thread_role::name::scheduler_manual);
run ();
} };
}
Expand Down
2 changes: 1 addition & 1 deletion nano/node/scheduler/optimistic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void nano::scheduler::optimistic::start ()
debug_assert (!thread.joinable ());

thread = std::thread{ [this] () {
nano::thread_role::set (nano::thread_role::name::optimistic_scheduler);
nano::thread_role::set (nano::thread_role::name::scheduler_optimistic);
run ();
} };
}
Expand Down
2 changes: 1 addition & 1 deletion nano/node/scheduler/priority.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void nano::scheduler::priority::start ()
debug_assert (!thread.joinable ());

thread = std::thread{ [this] () {
nano::thread_role::set (nano::thread_role::name::election_scheduler);
nano::thread_role::set (nano::thread_role::name::scheduler_priority);
run ();
} };
}
Expand Down

0 comments on commit 7abb90b

Please sign in to comment.