-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4281 from clemahieu/manual_scheduler
Separate manual scheduler in to its own class
- Loading branch information
Showing
19 changed files
with
262 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,50 @@ | ||
#include <nano/node/node.hpp> | ||
#include <nano/node/scheduler/component.hpp> | ||
#include <nano/node/scheduler/hinted.hpp> | ||
#include <nano/node/scheduler/manual.hpp> | ||
#include <nano/node/scheduler/optimistic.hpp> | ||
#include <nano/node/scheduler/priority.hpp> | ||
|
||
nano::scheduler::component::component (nano::node & node) : | ||
hinted_impl{ std::make_unique<nano::scheduler::hinted> (nano::scheduler::hinted::config{ node.config }, node, node.inactive_vote_cache, node.active, node.online_reps, node.stats) }, | ||
manual_impl{ std::make_unique<nano::scheduler::manual> (node) }, | ||
optimistic_impl{ std::make_unique<nano::scheduler::optimistic> (node.config.optimistic_scheduler, node, node.ledger, node.active, node.network_params.network, node.stats) }, | ||
priority_impl{ std::make_unique<nano::scheduler::priority> (node, node.stats) }, | ||
hinted_impl{ std::make_unique<nano::scheduler::hinted> (nano::scheduler::hinted::config{ node.config }, node, node.inactive_vote_cache, node.active, node.online_reps, node.stats) }, | ||
priority{ *priority_impl }, | ||
hinted{ *hinted_impl }, | ||
optimistic{ *optimistic_impl } | ||
manual{ *manual_impl }, | ||
optimistic{ *optimistic_impl }, | ||
priority{ *priority_impl } | ||
{ | ||
} | ||
|
||
nano::scheduler::component::~component () | ||
{ | ||
} | ||
|
||
void nano::scheduler::component::start () | ||
{ | ||
hinted.start (); | ||
manual.start (); | ||
optimistic.start (); | ||
priority.start (); | ||
} | ||
|
||
void nano::scheduler::component::stop () | ||
{ | ||
hinted.stop (); | ||
manual.stop (); | ||
optimistic.stop (); | ||
priority.stop (); | ||
} | ||
|
||
std::unique_ptr<nano::container_info_component> nano::scheduler::component::collect_container_info (std::string const & name) | ||
{ | ||
nano::unique_lock<nano::mutex> lock{ mutex }; | ||
|
||
auto composite = std::make_unique<container_info_composite> (name); | ||
//composite->add_component (hinted.collect_container_info ("hinted")); | ||
composite->add_component (manual.collect_container_info ("manual")); | ||
//composite->add_component (optimistic.collect_container_info ("optimistic")); | ||
composite->add_component (priority.collect_container_info ("priority")); | ||
return composite; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,44 @@ | ||
#pragma once | ||
|
||
#include <nano/lib/locks.hpp> | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
namespace nano | ||
{ | ||
class container_info_component; | ||
class node; | ||
} | ||
namespace nano::scheduler | ||
{ | ||
class hinted; | ||
class manual; | ||
class optimistic; | ||
class priority; | ||
|
||
class component | ||
class component final | ||
{ | ||
std::unique_ptr<nano::scheduler::hinted> hinted_impl; | ||
std::unique_ptr<nano::scheduler::manual> manual_impl; | ||
std::unique_ptr<nano::scheduler::optimistic> optimistic_impl; | ||
std::unique_ptr<nano::scheduler::priority> priority_impl; | ||
std::unique_ptr<nano::scheduler::hinted> hinted_impl; | ||
nano::mutex mutex; | ||
|
||
public: | ||
explicit component (nano::node & node); | ||
~component (); | ||
|
||
// Starts all schedulers | ||
void start (); | ||
// Stops all schedulers | ||
void stop (); | ||
|
||
std::unique_ptr<container_info_component> collect_container_info (std::string const & name); | ||
|
||
nano::scheduler::priority & priority; | ||
nano::scheduler::hinted & hinted; | ||
nano::scheduler::manual & manual; | ||
nano::scheduler::optimistic & optimistic; | ||
nano::scheduler::priority & priority; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.