Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill two getter simcalls, and replace them by (almost) direct calls to surf
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 1 Nov 2015 08:18:50 +0000 (09:18 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 1 Nov 2015 08:18:50 +0000 (09:18 +0100)
12 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

index fd0c576..28987a3 100644 (file)
@@ -61,6 +61,11 @@ XBT_PUBLIC(void) sg_host_edge_destroy(sg_host_t host, int do_callback);
 // Module initializer. Won't survive the conversion to C++. Hopefully.
 XBT_PUBLIC(void) sg_host_init(void);
 
 // Module initializer. Won't survive the conversion to C++. Hopefully.
 XBT_PUBLIC(void) sg_host_init(void);
 
+// =========== user-level functions ===============
+XBT_PUBLIC(double) sg_host_get_speed(sg_host_t host);
+XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
+
+
 SG_END_DECL()
 
 #endif /* SIMGRID_HOST_H_ */
 SG_END_DECL()
 
 #endif /* SIMGRID_HOST_H_ */
index 587d046..a2cce64 100644 (file)
@@ -303,8 +303,6 @@ XBT_PUBLIC(void) simcall_host_on(sg_host_t host);
 XBT_PUBLIC(void) simcall_host_off(sg_host_t host);
 XBT_PUBLIC(int) simcall_host_get_core(sg_host_t host);
 XBT_PUBLIC(xbt_swag_t) simcall_host_get_process_list(sg_host_t host);
 XBT_PUBLIC(void) simcall_host_off(sg_host_t host);
 XBT_PUBLIC(int) simcall_host_get_core(sg_host_t host);
 XBT_PUBLIC(xbt_swag_t) simcall_host_get_process_list(sg_host_t host);
-XBT_PUBLIC(double) simcall_host_get_speed(sg_host_t host);
-XBT_PUBLIC(double) simcall_host_get_available_speed(sg_host_t host);
 /* Two possible states, 1 - CPU ON and 0 CPU OFF */
 XBT_PUBLIC(int) simcall_host_get_state(sg_host_t host);
 XBT_PUBLIC(void *) simcall_host_get_data(sg_host_t host);
 /* Two possible states, 1 - CPU ON and 0 CPU OFF */
 XBT_PUBLIC(int) simcall_host_get_state(sg_host_t host);
 XBT_PUBLIC(void *) simcall_host_get_data(sg_host_t host);
index 438c777..20c3a2b 100644 (file)
@@ -236,7 +236,7 @@ double MSG_get_host_speed(msg_host_t h)
 {
   xbt_assert((h != NULL), "Invalid parameters");
 
 {
   xbt_assert((h != NULL), "Invalid parameters");
 
-  return (simcall_host_get_speed(h));
+  return (sg_host_get_speed(h));
 }
 
 
 }
 
 
index 069596f..36a9598 100644 (file)
@@ -122,14 +122,12 @@ void sg_host_edge_destroy(sg_host_t host, int do_callback) {
 }
 
 
 }
 
 
-
-/*
-host::host() {
-       // TODO Auto-generated constructor stub
-
+// =========== user-level functions ===============
+// ================================================
+double sg_host_get_speed(sg_host_t host){
+  return surf_host_get_speed(host, 1.0);
 }
 
 }
 
-host::~host() {
-       // TODO Auto-generated destructor stub
-}*/
-
+double sg_host_get_available_speed(sg_host_t host){
+  return surf_host_get_available_speed(host);
+}
index 67b8fe8..d5fba72 100644 (file)
@@ -68,20 +68,6 @@ xbt_dict_t simcall_asr_get_properties(const char *name)
   return simcall_BODY_asr_get_properties(name);
 }
 
   return simcall_BODY_asr_get_properties(name);
 }
 
-
-/**
- * \ingroup simix_host_management
- * \brief Returns the speed of the processor.
- *
- * The speed returned does not take into account the current load on the machine.
- * \param host A SIMIX host
- * \return The speed of this host (in Mflop/s)
- */
-double simcall_host_get_speed(sg_host_t host)
-{
-  return simcall_BODY_host_get_speed(host);
-}
-
 /**
  * \ingroup simix_host_management
  * \brief Returns the number of core of the processor.
 /**
  * \ingroup simix_host_management
  * \brief Returns the number of core of the processor.
@@ -106,18 +92,6 @@ xbt_swag_t simcall_host_get_process_list(sg_host_t host)
   return simcall_BODY_host_get_process_list(host);
 }
 
   return simcall_BODY_host_get_process_list(host);
 }
 
-
-/**
- * \ingroup simix_host_management
- * \brief Returns the available speed of the processor.
- *
- * \return Speed currently available (in Mflop/s)
- */
-double simcall_host_get_available_speed(sg_host_t host)
-{
-  return simcall_BODY_host_get_available_speed(host);
-}
-
 /**
  * \ingroup simix_host_management
  * \brief Returns the state of a host.
 /**
  * \ingroup simix_host_management
  * \brief Returns the state of a host.
index 2849332..abe3f62 100644 (file)
@@ -67,32 +67,6 @@ static inline void simcall_host_get_process_list__set__result(smx_simcall_t simc
     simcall->result.dp = result;
 }
 
     simcall->result.dp = result;
 }
 
-static inline sg_host_t simcall_host_get_speed__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_get_speed__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_host_get_speed__get__result(smx_simcall_t simcall){
-    return  simcall->result.d;
-}
-static inline void simcall_host_get_speed__set__result(smx_simcall_t simcall, double result){
-    simcall->result.d = result;
-}
-
-static inline sg_host_t simcall_host_get_available_speed__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_get_available_speed__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_host_get_available_speed__get__result(smx_simcall_t simcall){
-    return  simcall->result.d;
-}
-static inline void simcall_host_get_available_speed__set__result(smx_simcall_t simcall, double result){
-    simcall->result.d = result;
-}
-
 static inline sg_host_t simcall_host_get_state__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
 static inline sg_host_t simcall_host_get_state__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
index 961a2c2..1279a7d 100644 (file)
@@ -122,48 +122,6 @@ inline static xbt_swag_t simcall_BODY_host_get_process_list(sg_host_t host) {
     return self->simcall.result.dp;
   }
   
     return self->simcall.result.dp;
   }
   
-inline static double simcall_BODY_host_get_speed(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_speed(host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_SPEED;
-    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 double simcall_BODY_host_get_available_speed(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_available_speed(host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_AVAILABLE_SPEED;
-    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 int simcall_BODY_host_get_state(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
 inline static int simcall_BODY_host_get_state(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
index ebd9cca..51c05fa 100644 (file)
@@ -23,8 +23,6 @@ typedef enum {
   SIMCALL_HOST_GET_PROPERTIES,
   SIMCALL_HOST_GET_CORE,
   SIMCALL_HOST_GET_PROCESS_LIST,
   SIMCALL_HOST_GET_PROPERTIES,
   SIMCALL_HOST_GET_CORE,
   SIMCALL_HOST_GET_PROCESS_LIST,
-  SIMCALL_HOST_GET_SPEED,
-  SIMCALL_HOST_GET_AVAILABLE_SPEED,
   SIMCALL_HOST_GET_STATE,
   SIMCALL_HOST_GET_CURRENT_POWER_PEAK,
   SIMCALL_HOST_GET_POWER_PEAK_AT,
   SIMCALL_HOST_GET_STATE,
   SIMCALL_HOST_GET_CURRENT_POWER_PEAK,
   SIMCALL_HOST_GET_POWER_PEAK_AT,
index 53be99e..168fa16 100644 (file)
@@ -28,8 +28,6 @@ const char* simcall_names[] = {
   [SIMCALL_HOST_GET_PROPERTIES] = "SIMCALL_HOST_GET_PROPERTIES",
   [SIMCALL_HOST_GET_CORE] = "SIMCALL_HOST_GET_CORE",
   [SIMCALL_HOST_GET_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST",
   [SIMCALL_HOST_GET_PROPERTIES] = "SIMCALL_HOST_GET_PROPERTIES",
   [SIMCALL_HOST_GET_CORE] = "SIMCALL_HOST_GET_CORE",
   [SIMCALL_HOST_GET_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST",
-  [SIMCALL_HOST_GET_SPEED] = "SIMCALL_HOST_GET_SPEED",
-  [SIMCALL_HOST_GET_AVAILABLE_SPEED] = "SIMCALL_HOST_GET_AVAILABLE_SPEED",
   [SIMCALL_HOST_GET_STATE] = "SIMCALL_HOST_GET_STATE",
   [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_STATE] = "SIMCALL_HOST_GET_STATE",
   [SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK",
   [SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT",
@@ -192,16 +190,6 @@ case SIMCALL_HOST_GET_PROCESS_LIST:
       SIMIX_simcall_answer(simcall);
       break;  
 
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_HOST_GET_SPEED:
-      simcall->result.d = SIMIX_host_get_speed((sg_host_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_GET_AVAILABLE_SPEED:
-      simcall->result.d = SIMIX_host_get_available_speed((sg_host_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_HOST_GET_STATE:
       simcall->result.i = SIMIX_host_get_state((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
 case SIMCALL_HOST_GET_STATE:
       simcall->result.i = SIMIX_host_get_state((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
index f226048..c75f297 100644 (file)
@@ -51,8 +51,6 @@ Proc H host_off (void) (host, void*, sg_host_t)
 Func - host_get_properties (void*, xbt_dict_t) (host, void*, sg_host_t)
 Func - host_get_core (int) (host, void*, sg_host_t)
 Func - host_get_process_list (void*, xbt_swag_t) (host, void*, sg_host_t)
 Func - host_get_properties (void*, xbt_dict_t) (host, void*, sg_host_t)
 Func - host_get_core (int) (host, void*, sg_host_t)
 Func - host_get_process_list (void*, xbt_swag_t) (host, void*, sg_host_t)
-Func - host_get_speed (double) (host, void*, sg_host_t)
-Func - host_get_available_speed (double) (host, void*, sg_host_t)
 Func - host_get_state (int) (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_state (int) (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)
index 961ff9c..a1bb7c5 100644 (file)
@@ -166,9 +166,6 @@ xbt_dict_t SIMIX_host_get_properties(sg_host_t host){
   return surf_host_get_properties(surf_host_resource_priv(host));
 }
 
   return surf_host_get_properties(surf_host_resource_priv(host));
 }
 
-double SIMIX_host_get_speed(sg_host_t host){
-  return surf_host_get_speed(host, 1.0);
-}
 
 int SIMIX_host_get_core(sg_host_t host){
   return surf_host_get_core(host);
 
 int SIMIX_host_get_core(sg_host_t host){
   return surf_host_get_core(host);
@@ -181,10 +178,6 @@ xbt_swag_t SIMIX_host_get_process_list(sg_host_t host){
 }
 
 
 }
 
 
-double SIMIX_host_get_available_speed(sg_host_t host){
-  return surf_host_get_available_speed(host);
-}
-
 double SIMIX_host_get_current_power_peak(sg_host_t host) {
          return surf_host_get_current_power_peak(host);
 }
 double SIMIX_host_get_current_power_peak(sg_host_t host) {
          return surf_host_get_current_power_peak(host);
 }
@@ -354,7 +347,7 @@ smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name,
      * surf layer should not be zero (i.e., unlimited). It should be the
      * capacity of a CPU core. */
     if (bound == 0)
      * surf layer should not be zero (i.e., unlimited). It should be the
      * capacity of a CPU core. */
     if (bound == 0)
-      surf_cpu_action_set_bound(synchro->execution.surf_exec, SIMIX_host_get_speed(issuer->host));
+      surf_cpu_action_set_bound(synchro->execution.surf_exec, sg_host_get_speed(issuer->host));
     else
       surf_cpu_action_set_bound(synchro->execution.surf_exec, bound);
 
     else
       surf_cpu_action_set_bound(synchro->execution.surf_exec, bound);
 
index b0154cb..7ee4171 100644 (file)
@@ -40,8 +40,6 @@ 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 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 double SIMIX_host_get_speed(sg_host_t host);
-XBT_PRIVATE double SIMIX_host_get_available_speed(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_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);