Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename some methods of s4u::Host
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 17 Jun 2016 09:47:12 +0000 (11:47 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 17 Jun 2016 09:47:12 +0000 (11:47 +0200)
include/simgrid/s4u/host.hpp
src/msg/msg_host.cpp
src/s4u/s4u_host.cpp
src/smpi/smpi_dvfs.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
teshsuite/simdag/flatifier/flatifier.cpp

index ebe969b..6a4103e 100644 (file)
@@ -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<std::string, Storage*> *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
index e8db32a..e50f818 100644 (file)
@@ -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
index 7b9c90b..7bd578d 100644 (file)
@@ -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();
 }
 
index 5b1876e..e78e5b7 100644 (file)
@@ -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();
 }
 
 /**
index 64b46e6..c1ab0e1 100644 (file)
@@ -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)");
index 7a0922a..032df19 100644 (file)
@@ -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);
index bf94475..4a68e5e 100644 (file)
@@ -93,8 +93,8 @@ int main(int argc, char **argv)
     for (i = 0; i < totalHosts; i++) {
       printf("  <host id=\"%s\" speed=\"%.0f\"", sg_host_get_name(hosts[i]), sg_host_speed(hosts[i]));
       props = sg_host_get_properties(hosts[i]);
-      if (hosts[i]->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");