Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
inline another getter simcall: host_get_nb_pstates
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 5 Nov 2015 00:31:33 +0000 (01:31 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 5 Nov 2015 00:35:49 +0000 (01:35 +0100)
13 files changed:
include/simgrid/host.h
include/simgrid/simix.h
src/msg/msg_host.c
src/simgrid/host.cpp
src/simix/libsmx.c
src/simix/popping_accessors.h
src/simix/popping_bodies.c
src/simix/popping_enum.h
src/simix/popping_generated.c
src/simix/simcalls.in
src/simix/smx_host.c
src/simix/smx_host_private.h
src/smpi/smpi_dvfs.c

index f3fa3a6..1b38065 100644 (file)
@@ -67,6 +67,7 @@ XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
 XBT_PUBLIC(int) sg_host_get_core(sg_host_t host);
 XBT_PUBLIC(int) sg_host_get_state(sg_host_t host);
 
 XBT_PUBLIC(int) sg_host_get_core(sg_host_t host);
 XBT_PUBLIC(int) sg_host_get_state(sg_host_t host);
 
+XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host);
 XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host);
 XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host);
 
 XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host);
 XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host);
 
index 00ff99a..544f4c0 100644 (file)
@@ -307,7 +307,6 @@ XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
 
 XBT_PUBLIC(double) simcall_host_get_current_power_peak(sg_host_t host);
 XBT_PUBLIC(double) simcall_host_get_power_peak_at(sg_host_t host, int pstate_index);
 
 XBT_PUBLIC(double) simcall_host_get_current_power_peak(sg_host_t host);
 XBT_PUBLIC(double) simcall_host_get_power_peak_at(sg_host_t host, int pstate_index);
-XBT_PUBLIC(int) simcall_host_get_nb_pstates(sg_host_t host);
 XBT_PUBLIC(void) simcall_host_set_pstate(sg_host_t host, int pstate_index);
 XBT_PUBLIC(double) simcall_host_get_wattmin_at(sg_host_t host, int pstate);
 XBT_PUBLIC(double) simcall_host_get_wattmax_at(sg_host_t host, int pstate);
 XBT_PUBLIC(void) simcall_host_set_pstate(sg_host_t host, int pstate_index);
 XBT_PUBLIC(double) simcall_host_get_wattmin_at(sg_host_t host, int pstate);
 XBT_PUBLIC(double) simcall_host_get_wattmax_at(sg_host_t host, int pstate);
index 0cbac25..02d7f40 100644 (file)
@@ -383,9 +383,7 @@ double MSG_host_get_current_power_peak(msg_host_t host) {
  * \param  host host to test
  */
 int MSG_host_get_nb_pstates(msg_host_t host) {
  * \param  host host to test
  */
 int MSG_host_get_nb_pstates(msg_host_t host) {
-
-         xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
-         return (simcall_host_get_nb_pstates(host));
+         return sg_host_get_nb_pstates(host);
 }
 
 /** \ingroup m_host_management
 }
 
 /** \ingroup m_host_management
index 396f4a3..74e03b0 100644 (file)
@@ -141,12 +141,26 @@ int sg_host_get_state(sg_host_t host) {
        return surf_host_get_state(surf_host_resource_priv(host));
 }
 
        return surf_host_get_state(surf_host_resource_priv(host));
 }
 
-/** @brief Returns the total energy consumed by the host (in Joules) */
+/** @brief Returns the total energy consumed by the host (in Joules).
+ *
+ *  See also @ref SURF_plugin_energy.
+ */
 double sg_host_get_consumed_energy(sg_host_t host) {
        return surf_host_get_consumed_energy(host);
 }
 
 double sg_host_get_consumed_energy(sg_host_t host) {
        return surf_host_get_consumed_energy(host);
 }
 
-/** @brief Gets the pstate at which that host currently runs */
+/** @brief Returns the number of power states for a host.
+ *
+ *  See also @ref SURF_plugin_energy.
+ */
+int sg_host_get_nb_pstates(sg_host_t host) {
+       return surf_host_get_nb_pstates(host);
+}
+
+/** @brief Gets the pstate at which that host currently runs.
+ *
+ *  See also @ref SURF_plugin_energy.
+ */
 int sg_host_get_pstate(sg_host_t host) {
        return surf_host_get_pstate(host);
 }
 int sg_host_get_pstate(sg_host_t host) {
        return surf_host_get_pstate(host);
 }
index 44efe35..ab101d1 100644 (file)
@@ -105,18 +105,6 @@ double simcall_host_get_power_peak_at(sg_host_t host, int pstate_index)
   return simcall_BODY_host_get_power_peak_at(host, pstate_index);
 }
 
   return simcall_BODY_host_get_power_peak_at(host, pstate_index);
 }
 
-/**
- * \ingroup simix_host_management
- * \brief Returns the number of power states for a host.
- *
- * \param host A SIMIX host
- * \return the number of power states
- */
-int simcall_host_get_nb_pstates(sg_host_t host)
-{
-  return simcall_BODY_host_get_nb_pstates(host);
-}
-
 /**
  * \ingroup simix_host_management
  * \brief Sets the pstate at which the host should run
 /**
  * \ingroup simix_host_management
  * \brief Sets the pstate at which the host should run
index ae6c431..fd3d614 100644 (file)
@@ -86,19 +86,6 @@ static inline void simcall_host_get_power_peak_at__set__result(smx_simcall_t sim
     simcall->result.d = result;
 }
 
     simcall->result.d = result;
 }
 
-static inline sg_host_t simcall_host_get_nb_pstates__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_get_nb_pstates__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline int simcall_host_get_nb_pstates__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
-}
-static inline void simcall_host_get_nb_pstates__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
-}
-
 static inline sg_host_t simcall_host_get_wattmin_at__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
 static inline sg_host_t simcall_host_get_wattmin_at__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
index 779dbb0..ef7460e 100644 (file)
@@ -144,27 +144,6 @@ inline static double simcall_BODY_host_get_power_peak_at(sg_host_t host, int pst
     return self->simcall.result.d;
   }
   
     return self->simcall.result.d;
   }
   
-inline static int simcall_BODY_host_get_nb_pstates(sg_host_t host) {
-    smx_process_t self = SIMIX_process_self();
-
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_get_nb_pstates(host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_NB_PSTATES;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) host;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return self->simcall.result.i;
-  }
-  
 inline static double simcall_BODY_host_get_wattmin_at(sg_host_t host, int pstate_index) {
     smx_process_t self = SIMIX_process_self();
 
 inline static double simcall_BODY_host_get_wattmin_at(sg_host_t host, int pstate_index) {
     smx_process_t self = SIMIX_process_self();
 
index 937605d..cd27c75 100644 (file)
@@ -24,7 +24,6 @@ typedef enum {
   SIMCALL_HOST_GET_PROCESS_LIST,
   SIMCALL_HOST_GET_CURRENT_POWER_PEAK,
   SIMCALL_HOST_GET_POWER_PEAK_AT,
   SIMCALL_HOST_GET_PROCESS_LIST,
   SIMCALL_HOST_GET_CURRENT_POWER_PEAK,
   SIMCALL_HOST_GET_POWER_PEAK_AT,
-  SIMCALL_HOST_GET_NB_PSTATES,
   SIMCALL_HOST_GET_WATTMIN_AT,
   SIMCALL_HOST_GET_WATTMAX_AT,
   SIMCALL_HOST_SET_PSTATE,
   SIMCALL_HOST_GET_WATTMIN_AT,
   SIMCALL_HOST_GET_WATTMAX_AT,
   SIMCALL_HOST_SET_PSTATE,
index 0a8f7e6..55d72ff 100644 (file)
@@ -29,7 +29,6 @@ const char* simcall_names[] = {
   [SIMCALL_HOST_GET_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST",
   [SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK",
   [SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT",
   [SIMCALL_HOST_GET_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST",
   [SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK",
   [SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT",
-  [SIMCALL_HOST_GET_NB_PSTATES] = "SIMCALL_HOST_GET_NB_PSTATES",
   [SIMCALL_HOST_GET_WATTMIN_AT] = "SIMCALL_HOST_GET_WATTMIN_AT",
   [SIMCALL_HOST_GET_WATTMAX_AT] = "SIMCALL_HOST_GET_WATTMAX_AT",
   [SIMCALL_HOST_SET_PSTATE] = "SIMCALL_HOST_SET_PSTATE",
   [SIMCALL_HOST_GET_WATTMIN_AT] = "SIMCALL_HOST_GET_WATTMIN_AT",
   [SIMCALL_HOST_GET_WATTMAX_AT] = "SIMCALL_HOST_GET_WATTMAX_AT",
   [SIMCALL_HOST_SET_PSTATE] = "SIMCALL_HOST_SET_PSTATE",
@@ -191,11 +190,6 @@ case SIMCALL_HOST_GET_POWER_PEAK_AT:
       SIMIX_simcall_answer(simcall);
       break;  
 
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_HOST_GET_NB_PSTATES:
-      simcall->result.i = SIMIX_host_get_nb_pstates((sg_host_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_HOST_GET_WATTMIN_AT:
       simcall->result.d = SIMIX_host_get_wattmin_at((sg_host_t) simcall->args[0].dp, simcall->args[1].i);
       SIMIX_simcall_answer(simcall);
 case SIMCALL_HOST_GET_WATTMIN_AT:
       simcall->result.d = SIMIX_host_get_wattmin_at((sg_host_t) simcall->args[0].dp, simcall->args[1].i);
       SIMIX_simcall_answer(simcall);
index 8337d27..ffac959 100644 (file)
@@ -52,7 +52,6 @@ Func - host_get_properties (void*, xbt_dict_t) (host, void*, sg_host_t)
 Func - host_get_process_list (void*, xbt_swag_t) (host, void*, sg_host_t)
 Func - host_get_current_power_peak (double) (host, void*, sg_host_t)
 Func - host_get_power_peak_at (double) (host, void*, sg_host_t) (pstate_index, int)
 Func - host_get_process_list (void*, xbt_swag_t) (host, void*, sg_host_t)
 Func - host_get_current_power_peak (double) (host, void*, sg_host_t)
 Func - host_get_power_peak_at (double) (host, void*, sg_host_t) (pstate_index, int)
-Func - host_get_nb_pstates (int) (host, void*, sg_host_t)
 Func - host_get_wattmin_at (double) (host, void*, sg_host_t) (pstate_index, int)
 Func - host_get_wattmax_at (double) (host, void*, sg_host_t) (pstate_index, int)
 Proc - host_set_pstate (void) (host, void*, sg_host_t) (pstate_index, int)
 Func - host_get_wattmin_at (double) (host, void*, sg_host_t) (pstate_index, int)
 Func - host_get_wattmax_at (double) (host, void*, sg_host_t) (pstate_index, int)
 Proc - host_set_pstate (void) (host, void*, sg_host_t) (pstate_index, int)
index 1fb5227..276bc86 100644 (file)
@@ -182,11 +182,6 @@ double SIMIX_host_get_power_peak_at(sg_host_t host, int pstate_index) {
          return surf_host_get_power_peak_at(host, pstate_index);
 }
 
          return surf_host_get_power_peak_at(host, pstate_index);
 }
 
-int SIMIX_host_get_nb_pstates(sg_host_t host) {
-         return surf_host_get_nb_pstates(host);
-}
-
-
 void SIMIX_host_set_pstate(sg_host_t host, int pstate_index) {
          surf_host_set_pstate(host, pstate_index);
 }
 void SIMIX_host_set_pstate(sg_host_t host, int pstate_index) {
          surf_host_set_pstate(host, pstate_index);
 }
index 50c8a8e..1d80023 100644 (file)
@@ -41,7 +41,6 @@ XBT_PRIVATE xbt_dict_t SIMIX_host_get_properties(sg_host_t host);
 XBT_PRIVATE xbt_swag_t SIMIX_host_get_process_list(sg_host_t host);
 XBT_PRIVATE double SIMIX_host_get_current_power_peak(sg_host_t host);
 XBT_PRIVATE double SIMIX_host_get_power_peak_at(sg_host_t host, int pstate_index);
 XBT_PRIVATE xbt_swag_t SIMIX_host_get_process_list(sg_host_t host);
 XBT_PRIVATE double SIMIX_host_get_current_power_peak(sg_host_t host);
 XBT_PRIVATE double SIMIX_host_get_power_peak_at(sg_host_t host, int pstate_index);
-XBT_PRIVATE int SIMIX_host_get_nb_pstates(sg_host_t host);
 XBT_PRIVATE double SIMIX_host_get_wattmin_at(sg_host_t host,int pstate);
 XBT_PRIVATE double SIMIX_host_get_wattmax_at(sg_host_t host,int pstate);
 XBT_PRIVATE void SIMIX_host_set_pstate(sg_host_t host, int pstate_index);
 XBT_PRIVATE double SIMIX_host_get_wattmin_at(sg_host_t host,int pstate);
 XBT_PRIVATE double SIMIX_host_get_wattmax_at(sg_host_t host,int pstate);
 XBT_PRIVATE void SIMIX_host_set_pstate(sg_host_t host, int pstate_index);
index 3c16f52..57da464 100644 (file)
@@ -34,11 +34,11 @@ double smpi_get_host_current_power_peak(void)
 }
 
 /**
 }
 
 /**
- * \brief Return the number of pstates defined for host
+ * \brief Return the number of pstates defined for the current host
  */
 int smpi_get_host_nb_pstates(void)
 {
  */
 int smpi_get_host_nb_pstates(void)
 {
-  return simcall_host_get_nb_pstates(SIMIX_host_self());
+  return sg_host_get_nb_pstates(SIMIX_host_self());
 }
 
 /**
 }
 
 /**