-static int check(int argc, char* argv[])
-{
- msg_host_t host = MSG_host_self();
-
- int isDaemon = (MSG_process_self())->getImpl()->isDaemon();
- XBT_INFO("Bin ein Daemon: %d", isDaemon);
-
- simgrid::plugin::dvfs::Conservative governor(host);
- while (1) {
- // Sleep before updating; important for startup (i.e., t = 0).
- // In the beginning, we want to go with the pstates specified in the platform file
- // (so we sleep first)
- MSG_process_sleep(governor.samplingRate());
- governor.update();
- XBT_INFO("Governor just updated!");
- }
+ auto governor = [&dvfs_governor, &daemon_proc]() {
+ if (dvfs_governor == "conservative") {
+ return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
+ new simgrid::plugin::dvfs::Conservative(daemon_proc->get_host()));
+ } else if (dvfs_governor == "ondemand") {
+ return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
+ new simgrid::plugin::dvfs::OnDemand(daemon_proc->get_host()));
+ } else if (dvfs_governor == "performance") {
+ return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
+ new simgrid::plugin::dvfs::Performance(daemon_proc->get_host()));
+ } else if (dvfs_governor == "powersave") {
+ return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
+ new simgrid::plugin::dvfs::Powersave(daemon_proc->get_host()));
+ } else {
+ XBT_CRITICAL("No governor specified for host %s, falling back to Performance",
+ daemon_proc->get_host()->get_cname());
+ return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
+ new simgrid::plugin::dvfs::Performance(daemon_proc->get_host()));
+ }
+ }();
+
+ while (1) {
+ // Sleep *before* updating; important for startup (i.e., t = 0).
+ // In the beginning, we want to go with the pstates specified in the platform file
+ // (so we sleep first)
+ simgrid::s4u::this_actor::sleep_for(governor->samplingRate());
+ governor->update();
+ XBT_DEBUG("Governor (%s) just updated!", governor->getName().c_str());
+ }