From 7571100729971aa089eb33af2f93a5177fc83757 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Fri, 15 Jan 2016 15:26:45 +0100 Subject: [PATCH] [s4u] Host snake_case --- examples/s4u/io/s4u_io_test.cpp | 2 +- include/simgrid/s4u/host.hpp | 38 ++++++++++++++++----------------- src/msg/msg_host.cpp | 26 +++++++++++----------- src/msg/msg_io.cpp | 2 +- src/msg/msg_vm.cpp | 8 +++---- src/s4u/s4u_host.cpp | 36 +++++++++++++++---------------- src/simdag/sd_workstation.cpp | 4 ++-- src/simgrid/host.cpp | 10 ++++----- src/simix/libsmx.cpp | 14 ++++++------ src/simix/smx_host.cpp | 8 +++---- src/simix/smx_io.cpp | 12 +++++------ src/simix/smx_network.cpp | 4 ++-- src/simix/smx_process.cpp | 8 +++---- src/surf/plugins/energy.cpp | 13 +++++------ 14 files changed, 93 insertions(+), 92 deletions(-) diff --git a/examples/s4u/io/s4u_io_test.cpp b/examples/s4u/io/s4u_io_test.cpp index 0283cc797a..bc0eb0e0c0 100644 --- a/examples/s4u/io/s4u_io_test.cpp +++ b/examples/s4u/io/s4u_io_test.cpp @@ -36,7 +36,7 @@ public: int main(int argc, char **argv) { boost::unordered_map & mounts = - simgrid::s4u::Host::current()->mountedStorages(); + simgrid::s4u::Host::current()->mounted_storages(); show_info(mounts); diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index fa24695481..10b6bc974a 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -57,26 +57,26 @@ public: * 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 isOff() { return !isOn(); } - - double getSpeed(); - int getCoreAmount(); - xbt_dict_t getProperties(); - xbt_swag_t getProcessList(); - double getCurrentPowerPeak(); - double getPowerPeakAt(int pstate_index); - void setPState(int pstate_index); - int getNbPStates() const; - int getPState(); - void getParams(vm_params_t params); - void setParams(vm_params_t params); - xbt_dict_t getMountedStorageList(); - xbt_dynar_t getAttachedStorageList(); + bool is_on(); + bool is_off() { return !is_on(); } + + double speed(); + int core_count(); + xbt_dict_t properties(); + xbt_swag_t processes(); + double current_power_peak(); + double power_peak_at(int pstate_index); + void set_pstate(int pstate_index); + int pstates_count() const; + int pstate(); + void get_parameters(vm_params_t params); + void set_parameters(vm_params_t params); + xbt_dict_t mounted_storages_as_dict(); // HACK + xbt_dynar_t attached_storages(); /** Get an associative list [mount point]->[Storage] off all local mount points. * @@ -84,7 +84,7 @@ public: * * Do not change the returned value in any way. */ - boost::unordered_map &mountedStorages(); + boost::unordered_map &mounted_storages(); private: simgrid::xbt::string name_ = "noname"; diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 140253967e..46bb0c81fd 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -128,7 +128,7 @@ msg_host_t MSG_host_self(void) */ void MSG_host_on(msg_host_t host) { - host->turnOn(); + host->turn_on(); } /** \ingroup m_host_management @@ -139,7 +139,7 @@ void MSG_host_on(msg_host_t host) */ void MSG_host_off(msg_host_t host) { - host->turnOff(); + host->turn_off(); } /* @@ -203,7 +203,7 @@ xbt_dynar_t MSG_hosts_as_dynar(void) { the current load on the machine. */ double MSG_get_host_speed(msg_host_t host) { - return host->getSpeed(); + return host->speed(); } @@ -214,7 +214,7 @@ double MSG_get_host_speed(msg_host_t host) { * \return the number of cores */ int MSG_host_get_core_number(msg_host_t host) { - return host->getCoreAmount(); + return host->core_count(); } /** \ingroup m_host_management @@ -226,7 +226,7 @@ int MSG_host_get_core_number(msg_host_t host) { xbt_swag_t MSG_host_get_process_list(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters"); - return host->getProcessList(); + return host->processes(); } @@ -251,7 +251,7 @@ const char *MSG_host_get_property_value(msg_host_t host, const char *name) xbt_dict_t MSG_host_get_properties(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); - return host->getProperties(); + return host->properties(); } /** \ingroup m_host_management @@ -302,7 +302,7 @@ int MSG_host_is_off(msg_host_t host) */ void MSG_host_set_params(msg_host_t host, vm_params_t params) { - host->setParams(params); + host->set_parameters(params); } /** \ingroup m_host_management @@ -313,7 +313,7 @@ void MSG_host_set_params(msg_host_t host, vm_params_t params) */ void MSG_host_get_params(msg_host_t host, vm_params_t params) { - host->getParams(params); + host->get_parameters(params); } /** \ingroup m_host_management @@ -325,7 +325,7 @@ void MSG_host_get_params(msg_host_t host, vm_params_t params) */ double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); - return host->getPowerPeakAt(pstate_index); + return host->power_peak_at(pstate_index); } /** \ingroup m_host_management @@ -336,7 +336,7 @@ double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) { */ double MSG_host_get_current_power_peak(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); - return host->getCurrentPowerPeak(); + return host->current_power_peak(); } /** \ingroup m_host_management @@ -356,7 +356,7 @@ int MSG_host_get_nb_pstates(msg_host_t host) { xbt_dict_t MSG_host_get_mounted_storage_list(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters"); - return host->getMountedStorageList(); + return host->mounted_storages_as_dict(); } /** \ingroup m_host_management @@ -367,7 +367,7 @@ xbt_dict_t MSG_host_get_mounted_storage_list(msg_host_t host) xbt_dynar_t MSG_host_get_attached_storage_list(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters"); - return host->getAttachedStorageList(); + return host->attached_storages(); } /** \ingroup m_host_management @@ -384,7 +384,7 @@ xbt_dict_t MSG_host_get_storage_content(msg_host_t host) char* mount_name; xbt_dict_cursor_t cursor = NULL; - xbt_dict_t storage_list = host->getMountedStorageList(); + xbt_dict_t storage_list = host->mounted_storages_as_dict(); xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){ storage = (msg_storage_t)xbt_lib_get_elm_or_null(storage_lib,storage_name); diff --git a/src/msg/msg_io.cpp b/src/msg/msg_io.cpp index 6ac73c64a8..479f935c37 100644 --- a/src/msg/msg_io.cpp +++ b/src/msg/msg_io.cpp @@ -343,7 +343,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa msg_host_t host_dest; size_t longest_prefix_length = 0; - xbt_dict_t storage_list = host->getMountedStorageList(); + xbt_dict_t storage_list = host->mounted_storages_as_dict(); xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){ file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1)); strncpy(file_mount_name,fullpath,strlen(mount_name)+1); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 6510b2a29d..a78290c25f 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -46,7 +46,7 @@ const char *MSG_vm_get_property_value(msg_vm_t vm, const char *name) xbt_dict_t MSG_vm_get_properties(msg_vm_t vm) { xbt_assert((vm != NULL), "Invalid parameters (vm is NULL)"); - return vm->getProperties(); + return vm->properties(); } /** \ingroup m_host_management @@ -194,7 +194,7 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char *name, params.mig_speed = (double)mig_netspeed * 1024 * 1024; // mig_speed //XBT_INFO("dp rate %f migspeed : %f intensity mem : %d, updatespeed %f, hostspeed %f",params.dp_rate, params.mig_speed, dp_intensity, update_speed, host_speed); - vm->setParams(¶ms); + vm->set_parameters(¶ms); return vm; } @@ -357,7 +357,7 @@ static int migration_rx_fun(int argc, char *argv[]) struct migration_session *ms = (migration_session *) MSG_process_get_data(MSG_process_self()); s_vm_params_t params; - ms->vm->getParams(¶ms); + ms->vm->get_parameters(¶ms); int need_exit = 0; @@ -686,7 +686,7 @@ static int migration_tx_fun(int argc, char *argv[]) (migration_session *) MSG_process_get_data(MSG_process_self()); s_vm_params_t params; - ms->vm->getParams(¶ms); + ms->vm->get_parameters(¶ms); const sg_size_t ramsize = params.ramsize; const sg_size_t devsize = params.devsize; const int skip_stage1 = params.skip_stage1; diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index c327312306..615ac8b3e0 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -60,27 +60,27 @@ Host *Host::current(){ return SIMIX_process_get_host(smx_proc); } -void Host::turnOn() { +void Host::turn_on() { simgrid::simix::kernel(std::bind(SIMIX_host_on, this)); } -void Host::turnOff() { +void Host::turn_off() { simgrid::simix::simcall(SIMCALL_HOST_OFF, this); } -bool Host::isOn() { +bool Host::is_on() { return this->pimpl_cpu->isOn(); } -int Host::getNbPStates() const { +int Host::pstates_count() const { return this->pimpl_cpu->getNbPStates(); } -boost::unordered_map &Host::mountedStorages() { +boost::unordered_map &Host::mounted_storages() { if (mounts == NULL) { mounts = new boost::unordered_map (); - xbt_dict_t dict = this->getMountedStorageList(); + xbt_dict_t dict = this->mounted_storages_as_dict(); xbt_dict_cursor_t cursor; char *mountname; @@ -95,7 +95,7 @@ boost::unordered_map &Host::mountedStorages() { } /** Get the properties assigned to a host */ -xbt_dict_t Host::getProperties() { +xbt_dict_t Host::properties() { return simgrid::simix::kernel([&] { simgrid::surf::Host* surf_host = this->extension(); return surf_host->getProperties(); @@ -103,7 +103,7 @@ xbt_dict_t Host::getProperties() { } /** Get the processes attached to the host */ -xbt_swag_t Host::getProcessList() +xbt_swag_t Host::processes() { return simgrid::simix::kernel([&]() { return ((smx_host_priv_t)this->extension(SIMIX_HOST_LEVEL))->process_list; @@ -111,7 +111,7 @@ xbt_swag_t Host::getProcessList() } /** Get the peak power of a host */ -double Host::getCurrentPowerPeak() +double Host::current_power_peak() { return simgrid::simix::kernel([&] { return this->pimpl_cpu->getCurrentPowerPeak(); @@ -119,7 +119,7 @@ double Host::getCurrentPowerPeak() } /** Get one power peak (in flops/s) of a host at a given pstate */ -double Host::getPowerPeakAt(int pstate_index) +double Host::power_peak_at(int pstate_index) { return simgrid::simix::kernel([&] { return this->pimpl_cpu->getPowerPeakAt(pstate_index); @@ -127,11 +127,11 @@ double Host::getPowerPeakAt(int pstate_index) } /** @brief Get the speed of the cpu associated to a host */ -double Host::getSpeed() { +double Host::speed() { return pimpl_cpu->getSpeed(1.0); } /** @brief Returns the number of core of the processor. */ -int Host::getCoreAmount() { +int Host::core_count() { return pimpl_cpu->getCore(); } @@ -151,26 +151,26 @@ Host* Host::by_name_or_create(const char* name) } /** @brief Set the pstate at which the host should run */ -void Host::setPState(int pstate_index) +void Host::set_pstate(int pstate_index) { simgrid::simix::kernel(std::bind( &simgrid::surf::Cpu::setPState, pimpl_cpu, pstate_index )); } /** @brief Retrieve the pstate at which the host is currently running */ -int Host::getPState() +int Host::pstate() { return pimpl_cpu->getPState(); } -void Host::getParams(vm_params_t params) +void Host::get_parameters(vm_params_t params) { simgrid::simix::kernel([&]() { this->extension()->getParams(params); }); } -void Host::setParams(vm_params_t params) +void Host::set_parameters(vm_params_t params) { simgrid::simix::kernel([&]() { this->extension()->setParams(params); @@ -182,7 +182,7 @@ void Host::setParams(vm_params_t params) * \brief Returns the list of storages mounted on an host. * \return a dict containing all storages mounted on the host */ -xbt_dict_t Host::getMountedStorageList() +xbt_dict_t Host::mounted_storages_as_dict() { return simgrid::simix::kernel([&] { return this->extension()->getMountedStorageList(); @@ -194,7 +194,7 @@ xbt_dict_t Host::getMountedStorageList() * \brief Returns the list of storages attached to an host. * \return a dict containing all storages attached to the host */ -xbt_dynar_t Host::getAttachedStorageList() +xbt_dynar_t Host::attached_storages() { return simgrid::simix::kernel([&] { return this->extension()->getAttachedStorageList(); diff --git a/src/simdag/sd_workstation.cpp b/src/simdag/sd_workstation.cpp index 9b21a9a804..ac0bdb4e71 100644 --- a/src/simdag/sd_workstation.cpp +++ b/src/simdag/sd_workstation.cpp @@ -256,7 +256,7 @@ int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst) */ double SD_workstation_get_power(SD_workstation_t workstation) { - return workstation->getSpeed(); + return workstation->speed(); } /** * \brief Returns the amount of cores of a workstation @@ -265,7 +265,7 @@ double SD_workstation_get_power(SD_workstation_t workstation) * \return the amount of cores of this workstation */ int SD_workstation_get_cores(SD_workstation_t workstation) { - return workstation->getCoreAmount(); + return workstation->core_count(); } /** diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index dcde167a03..7b650aaee5 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -129,7 +129,7 @@ double sg_host_get_available_speed(sg_host_t host){ * @return 1 if the host is active or 0 if it has crashed. */ int sg_host_is_on(sg_host_t host) { - return host->isOn(); + return host->is_on(); } /** @brief Returns the number of power states for a host. @@ -137,7 +137,7 @@ int sg_host_is_on(sg_host_t host) { * See also @ref SURF_plugin_energy. */ int sg_host_get_nb_pstates(sg_host_t host) { - return host->getNbPStates(); + return host->pstates_count(); } /** @brief Gets the pstate at which that host currently runs. @@ -145,18 +145,18 @@ int sg_host_get_nb_pstates(sg_host_t host) { * See also @ref SURF_plugin_energy. */ int sg_host_get_pstate(sg_host_t host) { - return host->getPState(); + return host->pstate(); } /** @brief Sets the pstate at which that host should run. * * See also @ref SURF_plugin_energy. */ void sg_host_set_pstate(sg_host_t host,int pstate) { - host->setPState(pstate); + host->set_pstate(pstate); } /** @brief Get the properties of an host */ xbt_dict_t sg_host_get_properties(sg_host_t host) { - return host->getProperties(); + return host->properties(); } diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 32194f9ef8..5d4a4fb709 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -47,47 +47,47 @@ void simcall_call(smx_process_t process) * \deprecated */ xbt_swag_t simcall_host_get_process_list(sg_host_t host) { - return host->getProcessList(); + return host->processes(); } /** \ingroup simix_host_management * \deprecated */ double simcall_host_get_current_power_peak(sg_host_t host) { - return host->getCurrentPowerPeak(); + return host->current_power_peak(); } /** \ingroup simix_host_management * \deprecated */ double simcall_host_get_power_peak_at(sg_host_t host, int pstate_index) { - return host->getPowerPeakAt(pstate_index); + return host->power_peak_at(pstate_index); } /** \deprecated */ void simcall_host_get_params(sg_host_t vm, vm_params_t params) { - vm->getParams(params); + vm->get_parameters(params); } /** \deprecated */ void simcall_host_set_params(sg_host_t vm, vm_params_t params) { - vm->setParams(params); + vm->set_parameters(params); } /** \ingroup simix_storage_management * \deprecated */ xbt_dict_t simcall_host_get_mounted_storage_list(sg_host_t host) { - return host->getMountedStorageList(); + return host->mounted_storages_as_dict(); } /** \ingroup simix_storage_management * \deprecated */ xbt_dynar_t simcall_host_get_attached_storage_list(sg_host_t host) { - return host->getAttachedStorageList(); + return host->attached_storages(); } // ***** Other simcalls diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 111f9b3534..ad2f258867 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -44,7 +44,7 @@ void SIMIX_host_on(sg_host_t h) xbt_assert((host != NULL), "Invalid parameters"); - if (h->isOff()) { + if (h->is_off()) { simgrid::surf::Host* surf_host = h->extension(); surf_host->turnOn(); @@ -98,7 +98,7 @@ void SIMIX_host_off(sg_host_t h, smx_process_t issuer) xbt_assert((host != NULL), "Invalid parameters"); - if (h->isOn()) { + if (h->is_on()) { simgrid::surf::Host* surf_host = h->extension(); surf_host->turnOff(); @@ -480,7 +480,7 @@ void SIMIX_execution_finish(smx_synchro_t synchro) (int)synchro->state); } /* check if the host is down */ - if (simcall->issuer->host->isOff()) { + if (simcall->issuer->host->is_off()) { simcall->issuer->context->iwannadie = 1; } @@ -498,7 +498,7 @@ void SIMIX_post_host_execute(smx_synchro_t synchro) { if (synchro->type == SIMIX_SYNC_EXECUTE && /* FIMXE: handle resource failure * for parallel tasks too */ - synchro->execution.host->isOff()) { + synchro->execution.host->is_off()) { /* If the host running the synchro failed, notice it so that the asking * process can be killed if it runs on that host itself */ synchro->state = SIMIX_FAILED; diff --git a/src/simix/smx_io.cpp b/src/simix/smx_io.cpp index 046ff2f14b..dd2bb721c2 100644 --- a/src/simix/smx_io.cpp +++ b/src/simix/smx_io.cpp @@ -62,7 +62,7 @@ smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host) smx_synchro_t synchro; /* check if the host is active */ - if (host->isOff()) { + if (host->is_off()) { THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); } @@ -94,7 +94,7 @@ smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host) smx_synchro_t synchro; /* check if the host is active */ - if (host->isOff()) { + if (host->is_off()) { THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); } @@ -126,7 +126,7 @@ smx_synchro_t SIMIX_file_open(const char* fullpath, sg_host_t host) smx_synchro_t synchro; /* check if the host is active */ - if (host->isOff()) { + if (host->is_off()) { THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); } @@ -158,7 +158,7 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host) smx_synchro_t synchro; /* check if the host is active */ - if (host->isOff()) { + if (host->is_off()) { THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); } @@ -182,7 +182,7 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host) int SIMIX_file_unlink(smx_file_t fd, sg_host_t host) { /* check if the host is active */ - if (host->isOff()) { + if (host->is_off()) { THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); } @@ -376,7 +376,7 @@ void SIMIX_io_finish(smx_synchro_t synchro) (int)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 e2a05386ac..1cfc466b48 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -793,7 +793,7 @@ void SIMIX_comm_finish(smx_synchro_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 @@ -871,7 +871,7 @@ void SIMIX_comm_finish(smx_synchro_t synchro) } } - if (simcall->issuer->host->isOff()) { + if (simcall->issuer->host->is_off()) { simcall->issuer->context->iwannadie = 1; } diff --git a/src/simix/smx_process.cpp b/src/simix/smx_process.cpp index 46d0fbd5f5..aecd61f01b 100644 --- a/src/simix/smx_process.cpp +++ b/src/simix/smx_process.cpp @@ -167,7 +167,7 @@ void SIMIX_process_stop(smx_process_t arg) { /* execute the on_exit functions */ SIMIX_process_on_exit_runall(arg); /* Add the process to the list of process to restart, only if the host is down */ - if (arg->auto_restart && arg->host->isOff()) { + if (arg->auto_restart && arg->host->is_off()) { SIMIX_host_add_auto_restart_process(arg->host,arg->name,arg->code, arg->data, sg_host_get_name(arg->host), SIMIX_timer_get_date(arg->kill_timer), @@ -246,7 +246,7 @@ smx_process_t SIMIX_process_create( XBT_DEBUG("Start process %s on host '%s'", name, hostname); - if (host->isOff()) { + if (host->is_off()) { int i; XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, hostname); @@ -769,7 +769,7 @@ smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration) sg_host_t host = process->host; /* check if the host is active */ - if (host->isOff()) { + if (host->is_off()) { THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); } @@ -811,7 +811,7 @@ void SIMIX_post_process_sleep(smx_synchro_t synchro) 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, state); diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index 079b244636..bbbb065afc 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -83,7 +83,7 @@ void HostEnergy::update() double previous_energy = this->total_energy; double instantaneous_consumption; - if (host->isOff()) + if (host->is_off()) instantaneous_consumption = this->watts_off; else instantaneous_consumption = this->getCurrentWattsValue(cpu_load); @@ -102,8 +102,9 @@ HostEnergy::HostEnergy(simgrid::s4u::Host *ptr) : { initWattsRangeList(); - if (host->getProperties() != NULL) { - char* off_power_str = (char*)xbt_dict_get_or_null(host->getProperties(), "watt_off"); + if (host->properties() != NULL) { + char* off_power_str = (char*)xbt_dict_get_or_null( + host->properties(), "watt_off"); if (off_power_str != NULL) watts_off = atof(off_power_str); else @@ -138,7 +139,7 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) /* min_power corresponds to the idle power (cpu load = 0) */ /* max_power is the power consumed at 100% cpu load */ - auto range = power_range_watts_list.at(host->getPState()); + auto range = power_range_watts_list.at(host->pstate()); double min_power = range.first; double max_power = range.second; double power_slope = max_power - min_power; @@ -160,10 +161,10 @@ double HostEnergy::getConsumedEnergy() void HostEnergy::initWattsRangeList() { - if (host->getProperties() == NULL) + if (host->properties() == NULL) return; char* all_power_values_str = - (char*)xbt_dict_get_or_null(host->getProperties(), "watt_per_state"); + (char*)xbt_dict_get_or_null(host->properties(), "watt_per_state"); if (all_power_values_str == NULL) return; -- 2.20.1