From dd05e77cf9fe231aef1608d42c8e45ac3ee5c15c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 19 May 2018 00:03:48 +0200 Subject: [PATCH] snake_case some methods in s4u::Host --- examples/s4u/energy-boot/s4u-energy-boot.cpp | 4 +- examples/s4u/energy-exec/s4u-energy-exec.cpp | 4 +- .../s4u-platform-properties.cpp | 10 +-- .../plugin-hostload/s4u-plugin-hostload.cpp | 2 +- include/simgrid/s4u/Host.hpp | 36 +++++++--- src/bindings/lua/lua_platf.cpp | 2 +- src/kernel/activity/ExecImpl.cpp | 8 +-- src/kernel/activity/SleepImpl.cpp | 2 +- src/kernel/routing/NetZoneImpl.cpp | 2 +- src/plugins/vm/VirtualMachineImpl.cpp | 2 +- src/plugins/vm/VmLiveMigration.cpp | 4 +- src/s4u/s4u_Host.cpp | 67 +++++++++++-------- src/simix/ActorImpl.cpp | 8 +-- src/simix/smx_host.cpp | 4 +- src/simix/smx_io.cpp | 2 +- src/simix/smx_network.cpp | 4 +- src/smpi/internals/smpi_host.cpp | 6 +- src/surf/plugins/host_dvfs.cpp | 6 +- src/surf/plugins/host_energy.cpp | 6 +- teshsuite/s4u/actor/actor.cpp | 6 +- .../s4u/host_on_off_wait/host_on_off_wait.cpp | 2 +- 21 files changed, 105 insertions(+), 82 deletions(-) diff --git a/examples/s4u/energy-boot/s4u-energy-boot.cpp b/examples/s4u/energy-boot/s4u-energy-boot.cpp index 9d5aac85ae..d631c0006f 100644 --- a/examples/s4u/energy-boot/s4u-energy-boot.cpp +++ b/examples/s4u/energy-boot/s4u-energy-boot.cpp @@ -43,7 +43,7 @@ static void simulate_bootup(simgrid::s4u::Host* host) host->setPstate(3); XBT_INFO("Actually start the host"); - host->turnOn(); + host->turn_on(); XBT_INFO("Wait 150s to simulate the boot time."); simgrid::s4u::this_actor::sleep_for(150); @@ -66,7 +66,7 @@ static void simulate_shutdown(simgrid::s4u::Host* host) host->setPstate(previous_pstate); XBT_INFO("Actually shutdown the host"); - host->turnOff(); + host->turn_off(); } static int monitor() diff --git a/examples/s4u/energy-exec/s4u-energy-exec.cpp b/examples/s4u/energy-exec/s4u-energy-exec.cpp index b1893e15cd..846bc6db2f 100644 --- a/examples/s4u/energy-exec/s4u-energy-exec.cpp +++ b/examples/s4u/energy-exec/s4u-energy-exec.cpp @@ -13,7 +13,7 @@ static void dvfs() simgrid::s4u::Host* host1 = simgrid::s4u::Host::by_name("MyHost1"); simgrid::s4u::Host* host2 = simgrid::s4u::Host::by_name("MyHost2"); - XBT_INFO("Energetic profile: %s", host1->getProperty("watt_per_state")); + XBT_INFO("Energetic profile: %s", host1->get_property("watt_per_state")); XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", host1->getSpeed(), sg_host_get_consumed_energy(host1)); @@ -56,7 +56,7 @@ static void dvfs() // =========== Turn the other host off ========== XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.", sg_host_get_consumed_energy(host2)); - host2->turnOff(); + host2->turn_off(); start = simgrid::s4u::Engine::get_clock(); simgrid::s4u::this_actor::sleep_for(10); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", diff --git a/examples/s4u/platform-properties/s4u-platform-properties.cpp b/examples/s4u/platform-properties/s4u-platform-properties.cpp index fafbfa74ec..e616163996 100644 --- a/examples/s4u/platform-properties/s4u-platform-properties.cpp +++ b/examples/s4u/platform-properties/s4u-platform-properties.cpp @@ -23,26 +23,26 @@ static void test_host(std::string hostname) XBT_INFO(" Host property: '%s' -> '%s'", kv.first.c_str(), kv.second.c_str()); XBT_INFO("== Try to get a host property that does not exist"); - value = thehost->getProperty(noexist); + value = thehost->get_property(noexist); xbt_assert(not value, "The key exists (it's not supposed to)"); XBT_INFO("== Try to get a host property that does exist"); - value = thehost->getProperty(exist); + value = thehost->get_property(exist); xbt_assert(value, "\tProperty %s is undefined (where it should)", exist); xbt_assert(!strcmp(value, "180"), "\tValue of property %s is defined to %s (where it should be 180)", exist, value); XBT_INFO(" Property: %s old value: %s", exist, value); XBT_INFO("== Trying to modify a host property"); - thehost->setProperty(exist, "250"); + thehost->set_property(exist, "250"); /* Test if we have changed the value */ - value = thehost->getProperty(exist); + value = thehost->get_property(exist); xbt_assert(value, "Property %s is undefined (where it should)", exist); xbt_assert(!strcmp(value, "250"), "Value of property %s is defined to %s (where it should be 250)", exist, value); XBT_INFO(" Property: %s old value: %s", exist, value); /* Restore the value for the next test */ - thehost->setProperty(exist, "180"); + thehost->set_property(exist, "180"); } static int alice(int argc, char* argv[]) diff --git a/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp b/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp index ee43098cef..c18578597b 100644 --- a/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp +++ b/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp @@ -65,7 +65,7 @@ static void execute_load_test() s4u_Host* host2 = simgrid::s4u::Host::by_name("MyHost2"); XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 computed %.0f flops so far and has an average load of %.5f.", sg_host_get_computed_flops(host2), sg_host_get_avg_load(host2)); - host2->turnOff(); + host2->turn_off(); start = simgrid::s4u::Engine::get_clock(); simgrid::s4u::this_actor::sleep_for(10); XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E", diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 4ce6a6aa8f..15972ced07 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -80,29 +80,30 @@ public: /** Retrieves the name of that host as a C string */ const char* get_cname() const { return name_.c_str(); } - void actorList(std::vector * whereto); + int get_actor_count(); + std::vector get_all_actors(); /** Turns that host on if it was previously off * * All actors on that host which were marked autorestart will be restarted automatically. * This call does nothing if the host is already on. */ - void turnOn(); + void turn_on(); /** Turns that host off. All actors are forcefully stopped. */ - void turnOff(); + void turn_off(); /** Returns if that host is currently up and running */ - bool isOn(); + bool is_on(); /** Returns if that host is currently down and offline */ - bool isOff() { return not isOn(); } + bool is_off() { return not is_on(); } + + const char* get_property(const char* key); + void set_property(std::string key, std::string value); + std::map* getProperties(); double getSpeed(); double get_available_speed(); int getCoreCount(); - std::map* getProperties(); - const char* getProperty(const char* key); - void setProperty(std::string key, std::string value); - void getProcesses(std::vector * list); - int get_actor_count(); + double getPstateSpeed(int pstate_index); int getPstatesCount() const; void setPstate(int pstate_index); @@ -142,6 +143,21 @@ public: return name_; } XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_cname()") const char* getCname() const { return name_.c_str(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_all_actors()") void actorList(std::vector* whereto); + XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_all_actors()") void getProcesses(std::vector* list); + XBT_ATTRIB_DEPRECATED_v323("Please use Host::turn_on()") void turnOn() { turn_on(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Host::turn_off()") void turnOff() { turn_off(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Host::is_on()") bool isOn() { return is_on(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Host::is_off()") bool isOff() { return is_off(); } + + XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_property()") const char* getProperty(const char* key) + { + return get_property(key); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Host::set_property()") void setProperty(std::string key, std::string value) + { + set_property(key, value); + } private: simgrid::xbt::string name_{"noname"}; diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index 9279bdbd46..087381adcc 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -517,7 +517,7 @@ int console_host_set_property(lua_State *L) { sg_host_t host = sg_host_by_name(name); lua_ensure(host, "no host '%s' found",name); - host->setProperty(prop_id, prop_value); + host->set_property(prop_id, prop_value); return 0; } diff --git a/src/kernel/activity/ExecImpl.cpp b/src/kernel/activity/ExecImpl.cpp index a0e3cc2c9d..ebfa43b320 100644 --- a/src/kernel/activity/ExecImpl.cpp +++ b/src/kernel/activity/ExecImpl.cpp @@ -93,10 +93,10 @@ void simgrid::kernel::activity::ExecImpl::set_priority(double priority) void simgrid::kernel::activity::ExecImpl::post() { - if (host_ && host_->isOff()) { /* FIXME: handle resource failure for parallel tasks too */ - /* If the host running the synchro failed, notice it. This way, the asking - * process can be killed if it runs on that host itself */ - state_ = SIMIX_FAILED; + if (host_ && host_->is_off()) { /* FIXME: handle resource failure for parallel tasks too */ + /* If the host running the synchro failed, notice it. This way, the asking + * process can be killed if it runs on that host itself */ + state_ = SIMIX_FAILED; } else if (surf_action_ && surf_action_->get_state() == simgrid::kernel::resource::Action::State::FAILED) { /* If the host running the synchro didn't fail, then the synchro was canceled */ state_ = SIMIX_CANCELED; diff --git a/src/kernel/activity/SleepImpl.cpp b/src/kernel/activity/SleepImpl.cpp index 9fa18415ff..aea4da1f48 100644 --- a/src/kernel/activity/SleepImpl.cpp +++ b/src/kernel/activity/SleepImpl.cpp @@ -46,7 +46,7 @@ void simgrid::kernel::activity::SleepImpl::post() THROW_IMPOSSIBLE; break; } - if (simcall->issuer->host->isOff()) { + if (simcall->issuer->host->is_off()) { simcall->issuer->context->iwannadie = 1; } simcall_process_sleep__set__result(simcall, result); diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index bbcec30ea5..f70889a367 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -57,7 +57,7 @@ simgrid::s4u::Host* NetZoneImpl::create_host(const char* name, std::vectorsetProperty(kv.first, kv.second); + res->set_property(kv.first, kv.second); simgrid::s4u::Host::on_creation(*res); // notify the signal diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 326fde567a..350e3f4484 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -46,7 +46,7 @@ const double virt_overhead = 1; // 0.95 static void hostStateChange(s4u::Host& host) { - if (host.isOff()) { // just turned off. + if (host.is_off()) { // just turned off. std::vector trash; /* Find all VMs living on that host */ for (s4u::VirtualMachine* const& vm : VirtualMachineImpl::allVms_) diff --git a/src/plugins/vm/VmLiveMigration.cpp b/src/plugins/vm/VmLiveMigration.cpp index 55a01a9aa2..c6b77602ed 100644 --- a/src/plugins/vm/VmLiveMigration.cpp +++ b/src/plugins/vm/VmLiveMigration.cpp @@ -333,10 +333,10 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) { simgrid::s4u::Host* src_pm = vm->getPm(); - if (src_pm->isOff()) + if (src_pm->is_off()) THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->get_cname(), src_pm->get_cname()); - if (dst_pm->isOff()) + if (dst_pm->is_off()) THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->get_cname(), dst_pm->get_cname()); if (vm->getState() != SURF_VM_STATE_RUNNING) THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->get_cname()); diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 9aa141c5b6..1fbbf945ff 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -89,9 +89,9 @@ Host* Host::current() return smx_proc->host; } -void Host::turnOn() +void Host::turn_on() { - if (isOff()) { + if (is_off()) { simgrid::simix::simcall([this] { this->extension()->turnOn(); this->pimpl_cpu->turn_on(); @@ -101,9 +101,9 @@ void Host::turnOn() } /** @brief Stop the host if it is on */ -void Host::turnOff() +void Host::turn_off() { - if (isOn()) { + if (is_on()) { smx_actor_t self = SIMIX_process_self(); simgrid::simix::simcall([this, self] { simgrid::simix::Host* host = this->extension(); @@ -126,7 +126,7 @@ void Host::turnOff() } } -bool Host::isOn() +bool Host::is_on() { return this->pimpl_cpu->is_on(); } @@ -137,10 +137,33 @@ int Host::getPstatesCount() const } /** - * \brief Return the list of actors attached to an host. + * \brief Return a copy of the list of actors that are executing on this host. * - * \param whereto a vector in which we should push actors living on that host + * Daemons and regular actors are all mixed in this list. */ +std::vector Host::get_all_actors() +{ + std::vector res; + for (auto& actor : this->extension()->process_list) + res.push_back(actor.ciface()); + return res; +} + +/** @brief Returns how many actors (daemonized or not) have been launched on this host */ +int Host::get_actor_count() +{ + return this->extension()->process_list.size(); +} + +/** @deprecated */ +void Host::getProcesses(std::vector* list) +{ + for (auto& actor : this->extension()->process_list) { + list->push_back(actor.iface()); + } +} + +/** @deprecated */ void Host::actorList(std::vector* whereto) { for (auto& actor : this->extension()->process_list) { @@ -187,30 +210,16 @@ std::map* Host::getProperties() } /** Retrieve the property value (or nullptr if not set) */ -const char* Host::getProperty(const char* key) +const char* Host::get_property(const char* key) { return this->pimpl_->getProperty(key); } -void Host::setProperty(std::string key, std::string value) +void Host::set_property(std::string key, std::string value) { simgrid::simix::simcall([this, key, value] { this->pimpl_->setProperty(key, value); }); } -/** Get the processes attached to the host */ -void Host::getProcesses(std::vector* list) -{ - for (auto& actor : this->extension()->process_list) { - list->push_back(actor.iface()); - } -} - -/** @brief Returns how many actors (daemonized or not) have been launched on this host */ -int Host::get_actor_count() -{ - return this->extension()->process_list.size(); -} - /** @brief Get the peak processor speed (in flops/s), at the specified pstate */ double Host::getPstateSpeed(int pstate_index) { @@ -466,7 +475,7 @@ void sg_host_set_pstate(sg_host_t host, int pstate) */ void sg_host_turn_on(sg_host_t host) { - host->turnOn(); + host->turn_on(); } /** \ingroup m_host_management @@ -478,7 +487,7 @@ void sg_host_turn_on(sg_host_t host) */ void sg_host_turn_off(sg_host_t host) { - host->turnOff(); + host->turn_off(); } /** @ingroup m_host_management @@ -492,7 +501,7 @@ void sg_host_turn_off(sg_host_t host) */ int sg_host_is_on(sg_host_t host) { - return host->isOn(); + return host->is_on(); } /** @ingroup m_host_management @@ -503,7 +512,7 @@ int sg_host_is_on(sg_host_t host) */ int sg_host_is_off(sg_host_t host) { - return host->isOff(); + return host->is_off(); } /** @brief Get the properties of an host */ @@ -528,12 +537,12 @@ xbt_dict_t sg_host_get_properties(sg_host_t host) */ const char* sg_host_get_property_value(sg_host_t host, const char* name) { - return host->getProperty(name); + return host->get_property(name); } void sg_host_set_property_value(sg_host_t host, const char* name, const char* value) { - host->setProperty(name, value); + host->set_property(name, value); } /** diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 93196343d6..ec224ed131 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -236,7 +236,7 @@ void ActorImpl::resume() smx_activity_t ActorImpl::sleep(double duration) { - if (host->isOff()) + if (host->is_off()) THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->get_cname()); simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl(); @@ -294,7 +294,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function code, v XBT_DEBUG("Start process %s on host '%s'", name, host->get_cname()); - if (host->isOff()) { + if (host->is_off()) { XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->get_cname()); return nullptr; } @@ -354,7 +354,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn sg_host_t host = sg_host_by_name(hostname); XBT_DEBUG("Attach process %s on host '%s'", name, hostname); - if (host->isOff()) { + if (host->is_off()) { XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, hostname); return nullptr; } @@ -711,7 +711,7 @@ void SIMIX_process_yield(smx_actor_t self) /* execute the on_exit functions */ SIMIX_process_on_exit_runall(self); /* Add the process to the list of process to restart, only if the host is down */ - if (self->auto_restart && self->host->isOff()) { + if (self->auto_restart && self->host->is_off()) { SIMIX_host_add_auto_restart_process(self->host, self->get_cname(), self->code, self->getUserData(), SIMIX_timer_get_date(self->kill_timer), self->getProperties(), self->auto_restart); diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 0ff9a9e421..3a226978bc 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -86,7 +86,7 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std:: new simgrid::kernel::actor::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart); arg->properties.reset(properties, [](decltype(properties)) {}); - if (host->isOff() && watched_hosts.find(host->get_cname()) == watched_hosts.end()) { + if (host->is_off() && watched_hosts.find(host->get_cname()) == watched_hosts.end()) { watched_hosts.insert(host->get_cname()); XBT_DEBUG("Push host %s to watched_hosts because state == SURF_RESOURCE_OFF", host->get_cname()); } @@ -232,7 +232,7 @@ void SIMIX_execution_finish(smx_activity_t synchro) xbt_die("Internal error in SIMIX_execution_finish: unexpected synchro state %d", (int)exec->state_); } /* Fail the process if the host is down */ - if (simcall->issuer->host->isOff()) + if (simcall->issuer->host->is_off()) simcall->issuer->context->iwannadie = 1; simcall->issuer->waiting_synchro = nullptr; diff --git a/src/simix/smx_io.cpp b/src/simix/smx_io.cpp index bdc916652b..9e6591f9e5 100644 --- a/src/simix/smx_io.cpp +++ b/src/simix/smx_io.cpp @@ -80,7 +80,7 @@ void SIMIX_io_finish(smx_activity_t synchro) xbt_die("Internal error in SIMIX_io_finish: unexpected synchro state %d", static_cast(synchro->state_)); } - if (simcall->issuer->host->isOff()) { + if (simcall->issuer->host->is_off()) { simcall->issuer->context->iwannadie = 1; } diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 6a599e8f5e..c95d8b3b98 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -528,7 +528,7 @@ void SIMIX_comm_finish(smx_activity_t synchro) /* Check out for errors */ - if (simcall->issuer->host->isOff()) { + if (simcall->issuer->host->is_off()) { simcall->issuer->context->iwannadie = 1; SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); } else { @@ -616,7 +616,7 @@ void SIMIX_comm_finish(smx_activity_t synchro) } } - if (simcall->issuer->host->isOff()) { + if (simcall->issuer->host->is_off()) { simcall->issuer->context->iwannadie = 1; } diff --git a/src/smpi/internals/smpi_host.cpp b/src/smpi/internals/smpi_host.cpp index d8575d2baf..95c7284f66 100644 --- a/src/smpi/internals/smpi_host.cpp +++ b/src/smpi/internals/smpi_host.cpp @@ -93,21 +93,21 @@ Host::Host(simgrid::s4u::Host *ptr) : host(ptr) if (not Host::EXTENSION_ID.valid()) Host::EXTENSION_ID = simgrid::s4u::Host::extension_create(); - const char* orecv_string = host->getProperty("smpi/or"); + const char* orecv_string = host->get_property("smpi/or"); if (orecv_string != nullptr) { orecv_parsed_values = parse_factor(orecv_string); } else { orecv_parsed_values = parse_factor(simgrid::config::get_value("smpi/or")); } - const char* osend_string = host->getProperty("smpi/os"); + const char* osend_string = host->get_property("smpi/os"); if (osend_string != nullptr) { osend_parsed_values = parse_factor(osend_string); } else { osend_parsed_values = parse_factor(simgrid::config::get_value("smpi/os")); } - const char* oisend_string = host->getProperty("smpi/ois"); + const char* oisend_string = host->get_property("smpi/ois"); if (oisend_string != nullptr) { oisend_parsed_values = parse_factor(oisend_string); } else { diff --git a/src/surf/plugins/host_dvfs.cpp b/src/surf/plugins/host_dvfs.cpp index e5ea579ecb..af8ccc4a6d 100644 --- a/src/surf/plugins/host_dvfs.cpp +++ b/src/surf/plugins/host_dvfs.cpp @@ -41,7 +41,7 @@ public: void init() { - const char* local_sampling_rate_config = host_->getProperty(property_sampling_rate); + const char* local_sampling_rate_config = host_->get_property(property_sampling_rate); double global_sampling_rate_config = simgrid::config::get_value(property_sampling_rate); if (local_sampling_rate_config != nullptr) { sampling_rate = std::stod(local_sampling_rate_config); @@ -240,9 +240,9 @@ static void on_host_added(simgrid::s4u::Host& host) XBT_DEBUG("DVFS process on %s is a daemon: %d", daemon_proc->get_host()->get_cname(), daemon_proc->is_daemon()); std::string dvfs_governor; - const char* host_conf = daemon_proc->get_host()->getProperty(property_governor); + const char* host_conf = daemon_proc->get_host()->get_property(property_governor); if (host_conf != nullptr) { - dvfs_governor = std::string(daemon_proc->get_host()->getProperty(property_governor)); + dvfs_governor = std::string(daemon_proc->get_host()->get_property(property_governor)); boost::algorithm::to_lower(dvfs_governor); } else { dvfs_governor = simgrid::config::get_value(property_governor); diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index 3f76a5b28f..82fe90d338 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -176,14 +176,14 @@ void HostEnergy::update() } /* Save data for the upcoming time interval: whether it's on/off and the pstate if it's on */ - this->pstate = host->isOn() ? host->getPstate() : pstate_off; + this->pstate = host->is_on() ? host->getPstate() : pstate_off; } HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host(ptr), last_updated(surf_get_clock()) { initWattsRangeList(); - const char* off_power_str = host->getProperty("watt_off"); + const char* off_power_str = host->get_property("watt_off"); if (off_power_str != nullptr) { try { this->watts_off = std::stod(std::string(off_power_str)); @@ -314,7 +314,7 @@ double HostEnergy::getConsumedEnergy() void HostEnergy::initWattsRangeList() { - const char* all_power_values_str = host->getProperty("watt_per_state"); + const char* all_power_values_str = host->get_property("watt_per_state"); if (all_power_values_str == nullptr) return; diff --git a/teshsuite/s4u/actor/actor.cpp b/teshsuite/s4u/actor/actor.cpp index 2401959ae9..900310340e 100644 --- a/teshsuite/s4u/actor/actor.cpp +++ b/teshsuite/s4u/actor/actor.cpp @@ -22,10 +22,9 @@ static void worker() static void master() { simgrid::s4u::this_actor::sleep_for(1); - std::vector* actor_list = new std::vector(); - simgrid::s4u::this_actor::get_host()->actorList(actor_list); + std::vector actor_list = simgrid::s4u::this_actor::get_host()->get_all_actors(); - for (auto const& actor : *actor_list) { + for (auto const& actor : actor_list) { XBT_INFO("Actor (pid=%ld, ppid=%ld, name=%s)", actor->get_pid(), actor->get_ppid(), actor->get_cname()); if (simgrid::s4u::this_actor::get_pid() != actor->get_pid()) actor->kill(); @@ -48,7 +47,6 @@ static void master() simgrid::s4u::this_actor::sleep_for(2); actor->kill(); - delete actor_list; XBT_INFO("Goodbye now!"); } diff --git a/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp b/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp index 007b8940bf..280536ee27 100644 --- a/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp +++ b/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp @@ -14,7 +14,7 @@ static void master() simgrid::s4u::this_actor::sleep_for(1); XBT_INFO("Turning off the worker host"); - jupiter->turnOff(); + jupiter->turn_off(); XBT_INFO("Master has finished"); } -- 2.20.1