Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
inline two more simcalls: host_get_pstate and host_get_consumed_energy
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 2 Nov 2015 17:54:52 +0000 (18:54 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 2 Nov 2015 17:54:52 +0000 (18:54 +0100)
14 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/simix/smx_process.c
src/smpi/smpi_dvfs.c

index 46a7f53..f3fa3a6 100644 (file)
@@ -67,6 +67,9 @@ 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_pstate(sg_host_t host);
+XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host);
+
 
 SG_END_DECL()
 
index e05a156..00ff99a 100644 (file)
@@ -309,8 +309,6 @@ 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(int) simcall_host_get_pstate(sg_host_t host);
-XBT_PUBLIC(double) simcall_host_get_consumed_energy(sg_host_t host);
 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 bd937c8..0cbac25 100644 (file)
@@ -405,7 +405,7 @@ void MSG_host_set_pstate(msg_host_t host, int pstate_index) {
  * \param  host host to test
  */
 int MSG_host_get_pstate(msg_host_t host) {
-         return simcall_host_get_pstate(host);
+         return sg_host_get_pstate(host);
 }
 
 /** \ingroup m_host_management
@@ -416,7 +416,7 @@ int MSG_host_get_pstate(msg_host_t host) {
  */
 double MSG_host_get_consumed_energy(msg_host_t host) {
          xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
-         return simcall_host_get_consumed_energy(host);
+         return sg_host_get_consumed_energy(host);
 }
 /** \ingroup m_host_management
  * \brief Returns the amount of watt dissipated at the given pstate when the host is idling
index 14ef0cd..76695e1 100644 (file)
@@ -139,5 +139,15 @@ int sg_host_get_core(sg_host_t host) {
  *  @return 1 if the host is active or 0 if it has crashed.
  */
 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) */
+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 */
+int sg_host_get_pstate(sg_host_t host) {
+       return surf_host_get_pstate(host);
 }
index ae76c1e..44efe35 100644 (file)
@@ -128,28 +128,7 @@ void simcall_host_set_pstate(sg_host_t host, int pstate_index)
 {
        simcall_BODY_host_set_pstate(host, pstate_index);
 }
-/**
- * \ingroup simix_host_management
- * \brief Gets the pstate at which that host currently runs.
- *
- * \param host A SIMIX host
- */
-int simcall_host_get_pstate(sg_host_t host)
-{
-       return simcall_BODY_host_get_pstate(host);
-}
 
-/**
- * \ingroup simix_host_management
- * \brief Returns the total energy consumed by the host (in Joules)
- *
- * \param host A SIMIX host
- * \return the energy consumed by the host (double)
- */
-double simcall_host_get_consumed_energy(sg_host_t host)
-{
-  return simcall_BODY_host_get_consumed_energy(host);
-}
 /** \ingroup simix_host_management
  * \brief Returns the amount of watt dissipated at the given pstate when the host is idling
  */
index e812ee3..ae6c431 100644 (file)
@@ -150,32 +150,6 @@ static inline void simcall_host_set_pstate__set__pstate_index(smx_simcall_t simc
     simcall->args[1].i = arg;
 }
 
-static inline sg_host_t simcall_host_get_pstate__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_get_pstate__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline int simcall_host_get_pstate__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
-}
-static inline void simcall_host_get_pstate__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
-}
-
-static inline sg_host_t simcall_host_get_consumed_energy__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_get_consumed_energy__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_host_get_consumed_energy__get__result(smx_simcall_t simcall){
-    return  simcall->result.d;
-}
-static inline void simcall_host_get_consumed_energy__set__result(smx_simcall_t simcall, double result){
-    simcall->result.d = result;
-}
-
 static inline sg_host_t simcall_host_get_mounted_storage_list__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
index a8b91c4..779dbb0 100644 (file)
@@ -231,48 +231,6 @@ inline static void simcall_BODY_host_set_pstate(sg_host_t host, int pstate_index
     
   }
   
-inline static int simcall_BODY_host_get_pstate(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_pstate(host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_PSTATE;
-    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_consumed_energy(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_consumed_energy(host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_CONSUMED_ENERGY;
-    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.d;
-  }
-  
 inline static xbt_dict_t simcall_BODY_host_get_mounted_storage_list(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
index eba24c1..937605d 100644 (file)
@@ -28,8 +28,6 @@ typedef enum {
   SIMCALL_HOST_GET_WATTMIN_AT,
   SIMCALL_HOST_GET_WATTMAX_AT,
   SIMCALL_HOST_SET_PSTATE,
-  SIMCALL_HOST_GET_PSTATE,
-  SIMCALL_HOST_GET_CONSUMED_ENERGY,
   SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST,
   SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST,
   SIMCALL_HOST_GET_PARAMS,
index b86f5e9..0a8f7e6 100644 (file)
@@ -33,8 +33,6 @@ const char* simcall_names[] = {
   [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_PSTATE] = "SIMCALL_HOST_GET_PSTATE",
-  [SIMCALL_HOST_GET_CONSUMED_ENERGY] = "SIMCALL_HOST_GET_CONSUMED_ENERGY",
   [SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST] = "SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST",
   [SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST] = "SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST",
   [SIMCALL_HOST_GET_PARAMS] = "SIMCALL_HOST_GET_PARAMS",
@@ -213,16 +211,6 @@ case SIMCALL_HOST_SET_PSTATE:
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_HOST_GET_PSTATE:
-      simcall->result.i = SIMIX_host_get_pstate((sg_host_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_GET_CONSUMED_ENERGY:
-      simcall->result.d = SIMIX_host_get_consumed_energy((sg_host_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST:
       simcall->result.dp = SIMIX_host_get_mounted_storage_list((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
index 0149fbd..8337d27 100644 (file)
@@ -56,8 +56,6 @@ 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_pstate (int) (host, void*, sg_host_t)
-Func - host_get_consumed_energy (double) (host, void*, sg_host_t)
 
 Func - host_get_mounted_storage_list (void*, xbt_dict_t) (host, void*, sg_host_t)
 Func - host_get_attached_storage_list (void*, xbt_dynar_t) (host, void*, sg_host_t)
index a1bb7c5..1fb5227 100644 (file)
@@ -167,10 +167,6 @@ xbt_dict_t SIMIX_host_get_properties(sg_host_t host){
 }
 
 
-int SIMIX_host_get_core(sg_host_t host){
-  return surf_host_get_core(host);
-}
-
 xbt_swag_t SIMIX_host_get_process_list(sg_host_t host){
   smx_host_priv_t host_priv = sg_host_simix(host);
 
@@ -194,13 +190,6 @@ int SIMIX_host_get_nb_pstates(sg_host_t host) {
 void SIMIX_host_set_pstate(sg_host_t host, int pstate_index) {
          surf_host_set_pstate(host, pstate_index);
 }
-int SIMIX_host_get_pstate(sg_host_t host) {
-         return surf_host_get_pstate(host);
-}
-
-double SIMIX_host_get_consumed_energy(sg_host_t host) {
-         return surf_host_get_consumed_energy(host);
-}
 double SIMIX_host_get_wattmin_at(sg_host_t host,int pstate) {
          return surf_host_get_wattmin_at(host,pstate);
 }
@@ -208,10 +197,6 @@ double SIMIX_host_get_wattmax_at(sg_host_t host,int pstate) {
          return surf_host_get_wattmax_at(host,pstate);
 }
 
-int SIMIX_host_get_state(sg_host_t host){
-  return surf_host_get_state(surf_host_resource_priv(host));
-}
-
 void _SIMIX_host_free_process_arg(void *data)
 {
   smx_process_arg_t arg = *(void**)data;
@@ -261,7 +246,7 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host,
   arg->properties = properties;
   arg->auto_restart = auto_restart;
 
-  if( SIMIX_host_get_state(host) == SURF_RESOURCE_OFF
+  if( sg_host_get_state(host) == SURF_RESOURCE_OFF
       && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_name(host))){
     xbt_dict_set(watched_hosts_lib,sg_host_name(host),host,NULL);
     XBT_DEBUG("Have pushed host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_name(host));
index 7ee4171..50c8a8e 100644 (file)
@@ -38,17 +38,13 @@ XBT_PRIVATE void SIMIX_host_add_auto_restart_process(sg_host_t host,
 XBT_PRIVATE void SIMIX_host_restart_processes(sg_host_t host);
 XBT_PRIVATE void SIMIX_host_autorestart(sg_host_t host);
 XBT_PRIVATE xbt_dict_t SIMIX_host_get_properties(sg_host_t host);
-XBT_PRIVATE int SIMIX_host_get_core(sg_host_t host);
 XBT_PRIVATE xbt_swag_t SIMIX_host_get_process_list(sg_host_t host);
-XBT_PRIVATE int SIMIX_host_get_state(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_consumed_energy(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 int SIMIX_host_get_pstate(sg_host_t host);
 XBT_PRIVATE smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name,
     double flops_amount, double priority, double bound, unsigned long affinity_mask);
 XBT_PRIVATE smx_synchro_t SIMIX_process_parallel_execute(const char *name,
index 2fac9cf..57d32af 100644 (file)
@@ -163,7 +163,7 @@ void SIMIX_process_stop(smx_process_t arg) {
   /* Add the process to the list of process to restart, only if
    * the host is down
    */
-  if (arg->auto_restart && !SIMIX_host_get_state(arg->host)) {
+  if (arg->auto_restart && !sg_host_get_state(arg->host)) {
     SIMIX_host_add_auto_restart_process(arg->host,arg->name,arg->code, arg->data,
                                         sg_host_name(arg->host),
                                         SIMIX_timer_get_date(arg->kill_timer),
@@ -236,7 +236,7 @@ smx_process_t SIMIX_process_create(
 
   XBT_DEBUG("Start process %s on host '%s'", name, hostname);
 
-  if (!SIMIX_host_get_state(host)) {
+  if (!sg_host_get_state(host)) {
     int i;
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name,
           hostname);
index 04d2bcf..3c16f52 100644 (file)
@@ -55,9 +55,8 @@ void smpi_set_host_pstate(int pstate_index)
  *
  * \param pstate_index pstate to switch to
  */
-int smpi_get_host_pstate()
-{
-  return simcall_host_get_pstate(SIMIX_host_self());
+int smpi_get_host_pstate() {
+  return sg_host_get_pstate(SIMIX_host_self());
 }
 
 /**
@@ -65,9 +64,8 @@ int smpi_get_host_pstate()
  *
  * \return Returns the consumed energy
  */
-double smpi_get_host_consumed_energy(void)
-{
-  return simcall_host_get_consumed_energy(SIMIX_host_self());
+double smpi_get_host_consumed_energy(void) {
+  return sg_host_get_consumed_energy(SIMIX_host_self());
 }