From: Martin Quinson Date: Fri, 17 Jun 2016 09:47:12 +0000 (+0200) Subject: rename some methods of s4u::Host X-Git-Tag: v3_14~974 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3cb7565abeaa2a0e48daac342e7e2291c5a98138 rename some methods of s4u::Host --- diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index ebe969bf41..6a4103e731 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -70,13 +70,13 @@ public: // TODO, make me private bool isOff() { return !isOn(); } double speed(); - int core_count(); + int coresCount(); xbt_dict_t properties(); const char*property(const char*key); void setProperty(const char*key, const char *value); xbt_swag_t processes(); - double currentPowerPeak(); - double powerPeakAt(int pstate_index); + double getPstateSpeedCurrent(); + double getPstateSpeed(int pstate_index); int pstatesCount() const; void setPstate(int pstate_index); int pstate(); @@ -96,10 +96,10 @@ private: boost::unordered_map *mounts = nullptr; // caching public: - // FIXME: these should be protected, but it leads to many errors - // Use the extensions stuff for this? Go through simgrid::surf::Host? // TODO, this could be a unique_ptr + /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */ surf::Cpu *pimpl_cpu = nullptr; + /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */ surf::NetCard *pimpl_netcard = nullptr; public: @@ -130,20 +130,6 @@ extern int USER_HOST_LEVEL; package org.simgrid.msg; -import org.simgrid.msg.Storage; - -/* -Host jacquelin; - -try { - jacquelin = Host.getByName("Jacquelin"); -} catch(HostNotFoundException e) { - System.err.println(e.toString()); -} -... -\endverbatim - * - */ public class Host { /** * This static method returns all of the hosts of the installed platform. @@ -174,32 +160,6 @@ public class Host { */ public native int getLoad(); - /** - * This method returns the speed of the processor of a host, - * regardless of the current load of the machine. - * - * @return The speed of the processor of the host in flops. - * - */ - public native double getSpeed(); - - /** - * This method returns the number of core of a host. - * - * @return The speed of the processor of the host in flops. - * - */ - public native double getCoreNumber(); - - /** - * Returns the value of a given host property (set from the platform file). - */ - public native String getProperty(String name); - - /** - * Change the value of a given host property. - */ - public native void setProperty(String name, String value); /** This methods returns the list of storages attached to an host * @return An array containing all storages (name) attached to the host diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index e8db32ad32..e50f818115 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -166,7 +166,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->core_count(); + return host->coresCount(); } /** \ingroup m_host_management @@ -271,7 +271,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 != nullptr), "Invalid parameters (host is nullptr)"); - return host->powerPeakAt(pstate_index); + return host->getPstateSpeed(pstate_index); } /** \ingroup m_host_management @@ -282,7 +282,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 != nullptr), "Invalid parameters (host is nullptr)"); - return host->currentPowerPeak(); + return host->getPstateSpeedCurrent(); } /** \ingroup m_host_management diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 7b9c90bfee..7bd578d582 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -138,18 +138,18 @@ xbt_swag_t Host::processes() } /** Get the peak power of a host */ -double Host::currentPowerPeak() +double Host::getPstateSpeedCurrent() { return simgrid::simix::kernel([&] { - return this->pimpl_cpu->getCurrentPowerPeak(); + return this->pimpl_cpu->getPstateSpeedCurrent(); }); } /** Get one power peak (in flops/s) of a host at a given pstate */ -double Host::powerPeakAt(int pstate_index) +double Host::getPstateSpeed(int pstate_index) { return simgrid::simix::kernel([&] { - return this->pimpl_cpu->getPowerPeakAt(pstate_index); + return this->pimpl_cpu->getPstateSpeed(pstate_index); }); } @@ -158,7 +158,7 @@ double Host::speed() { return pimpl_cpu->getSpeed(1.0); } /** @brief Returns the number of core of the processor. */ -int Host::core_count() { +int Host::coresCount() { return pimpl_cpu->getCore(); } diff --git a/src/smpi/smpi_dvfs.cpp b/src/smpi/smpi_dvfs.cpp index 5b1876e29c..e78e5b71ba 100644 --- a/src/smpi/smpi_dvfs.cpp +++ b/src/smpi/smpi_dvfs.cpp @@ -20,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi, "Logging specific to SMPI (expe */ double smpi_get_host_power_peak_at(int pstate_index) { - return SIMIX_host_self()->powerPeakAt(pstate_index); + return SIMIX_host_self()->getPstateSpeed(pstate_index); } /** @@ -30,7 +30,7 @@ double smpi_get_host_power_peak_at(int pstate_index) */ double smpi_get_host_current_power_peak(void) { - return SIMIX_host_self()->currentPowerPeak(); + return SIMIX_host_self()->getPstateSpeedCurrent(); } /** diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 64b46e648c..c1ab0e1f6c 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -176,7 +176,7 @@ Cpu::~Cpu() xbt_dynar_free(&speedPerPstate_); } -double Cpu::getCurrentPowerPeak() +double Cpu::getPstateSpeedCurrent() { return speed_.peak; } @@ -204,7 +204,7 @@ int Cpu::getPState() return pstate_; } -double Cpu::getPowerPeakAt(int pstate_index) +double Cpu::getPstateSpeed(int pstate_index) { xbt_dynar_t plist = speedPerPstate_; xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)"); diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 7a0922ad0c..032df194e0 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -119,10 +119,9 @@ public: /** @brief Get the available speed of the current Cpu */ virtual double getAvailableSpeed(); - /** @brief Get the current Cpu power peak */ - virtual double getCurrentPowerPeak(); - - virtual double getPowerPeakAt(int pstate_index); + /** @brief Get the current Cpu computational speed */ + virtual double getPstateSpeedCurrent(); + virtual double getPstateSpeed(int pstate_index); virtual int getNbPStates(); virtual void setPState(int pstate_index); diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index bf94475198..4a68e5e64b 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -93,8 +93,8 @@ int main(int argc, char **argv) for (i = 0; i < totalHosts; i++) { printf(" core_count()>1) { - printf(" core=\"%d\"", hosts[i]->core_count()); + if (hosts[i]->coresCount()>1) { + printf(" core=\"%d\"", hosts[i]->coresCount()); } if (props && !xbt_dict_is_empty(props)) { printf(">\n");