Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
inline two more getter simcalls: host_get_core and host_get_state
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 1 Nov 2015 23:39:29 +0000 (00:39 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 1 Nov 2015 23:39:29 +0000 (00:39 +0100)
include/simgrid/host.h
include/simgrid/simix.h
src/msg/msg_host.c
src/s4u/s4u_host.cpp
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

index 28987a3..46a7f53 100644 (file)
@@ -64,6 +64,8 @@ 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);
 // =========== 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);
+XBT_PUBLIC(int) sg_host_get_core(sg_host_t host);
+XBT_PUBLIC(int) sg_host_get_state(sg_host_t host);
 
 
 SG_END_DECL()
 
 
 SG_END_DECL()
index a2cce64..e05a156 100644 (file)
@@ -301,11 +301,7 @@ XBT_PUBLIC(void) SIMIX_comm_finish(smx_synchro_t synchro);
 XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(sg_host_t host);
 XBT_PUBLIC(void) simcall_host_on(sg_host_t host);
 XBT_PUBLIC(void) simcall_host_off(sg_host_t host);
 XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(sg_host_t host);
 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(xbt_swag_t) simcall_host_get_process_list(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);
 
 XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
 
 
 XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
 
index 20c3a2b..bd937c8 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 (sg_host_get_speed(h));
+  return sg_host_get_speed(h);
 }
 
 
 }
 
 
@@ -250,7 +250,7 @@ int MSG_host_get_core_number(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters");
 
 {
   xbt_assert((host != NULL), "Invalid parameters");
 
-  return (simcall_host_get_core(host));
+  return sg_host_get_core(host);
 }
 
 /** \ingroup m_host_management
 }
 
 /** \ingroup m_host_management
@@ -318,7 +318,7 @@ void MSG_host_set_property_value(msg_host_t host, const char *name, char *value,
 int MSG_host_is_on(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
 int MSG_host_is_on(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
-  return (simcall_host_get_state(host));
+  return sg_host_get_state(host);
 }
 /** @ingroup m_host_management
  *
 }
 /** @ingroup m_host_management
  *
@@ -329,7 +329,7 @@ int MSG_host_is_on(msg_host_t host)
 int MSG_host_is_off(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
 int MSG_host_is_off(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
-  return !(simcall_host_get_state(host));
+  return !(sg_host_get_state(host));
 }
 
 /** \ingroup m_host_management
 }
 
 /** \ingroup m_host_management
index ee6ea5b..30c08ab 100644 (file)
@@ -58,7 +58,7 @@ void Host::turnOff() {
        simcall_host_off(p_inferior);
 }
 bool Host::isOn() {
        simcall_host_off(p_inferior);
 }
 bool Host::isOn() {
-       return simcall_host_get_state(p_inferior);
+       return sg_host_get_state(p_inferior);
 }
 
 boost::unordered_map<std::string, Storage&> &Host::mountedStorages() {
 }
 
 boost::unordered_map<std::string, Storage&> &Host::mountedStorages() {
index 36a9598..14ef0cd 100644 (file)
@@ -131,3 +131,13 @@ double sg_host_get_speed(sg_host_t host){
 double sg_host_get_available_speed(sg_host_t host){
   return surf_host_get_available_speed(host);
 }
 double sg_host_get_available_speed(sg_host_t host){
   return surf_host_get_available_speed(host);
 }
+/** @brief Returns the number of core of the processor. */
+int sg_host_get_core(sg_host_t host) {
+       return surf_host_get_core(host);
+}
+/** @brief Returns the state of a 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));
+}
index d5fba72..ae76c1e 100644 (file)
@@ -68,18 +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 number of core of the processor.
- *
- * \param host A SIMIX host
- * \return The number of core
- */
-int simcall_host_get_core(sg_host_t host)
-{
-  return simcall_BODY_host_get_core(host);
-}
-
 /**
  * \ingroup simix_host_management
  * \brief Returns the list of processes attached to the host.
 /**
  * \ingroup simix_host_management
  * \brief Returns the list of processes attached to the host.
@@ -92,19 +80,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 state of a host.
- *
- * Two states are possible: 1 if the host is active or 0 if it has crashed.
- * \param host A SIMIX host
- * \return 1 if the host is available, 0 otherwise
- */
-int simcall_host_get_state(sg_host_t host)
-{
-  return simcall_BODY_host_get_state(host);
-}
-
 /**
  * \ingroup simix_host_management
  * \brief Returns the power peak of a host.
 /**
  * \ingroup simix_host_management
  * \brief Returns the power peak of a host.
index abe3f62..e812ee3 100644 (file)
@@ -41,19 +41,6 @@ static inline void simcall_host_get_properties__set__result(smx_simcall_t simcal
     simcall->result.dp = result;
 }
 
     simcall->result.dp = result;
 }
 
-static inline sg_host_t simcall_host_get_core__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_get_core__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline int simcall_host_get_core__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
-}
-static inline void simcall_host_get_core__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
-}
-
 static inline sg_host_t simcall_host_get_process_list__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
 static inline sg_host_t simcall_host_get_process_list__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
@@ -67,19 +54,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_state__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
-}
-static inline void simcall_host_get_state__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline int simcall_host_get_state__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
-}
-static inline void simcall_host_get_state__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
-}
-
 static inline sg_host_t simcall_host_get_current_power_peak__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
 static inline sg_host_t simcall_host_get_current_power_peak__get__host(smx_simcall_t simcall) {
   return (sg_host_t) simcall->args[0].dp;
 }
index 1279a7d..a8b91c4 100644 (file)
@@ -80,27 +80,6 @@ inline static xbt_dict_t simcall_BODY_host_get_properties(sg_host_t host) {
     return self->simcall.result.dp;
   }
   
     return self->simcall.result.dp;
   }
   
-inline static int simcall_BODY_host_get_core(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_core(host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_CORE;
-    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 xbt_swag_t simcall_BODY_host_get_process_list(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
 inline static xbt_swag_t simcall_BODY_host_get_process_list(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
@@ -122,27 +101,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 int simcall_BODY_host_get_state(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_state(host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_STATE;
-    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_current_power_peak(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
 inline static double simcall_BODY_host_get_current_power_peak(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
index 51c05fa..eba24c1 100644 (file)
@@ -21,9 +21,7 @@ typedef enum {
   SIMCALL_HOST_ON,
   SIMCALL_HOST_OFF,
   SIMCALL_HOST_GET_PROPERTIES,
   SIMCALL_HOST_ON,
   SIMCALL_HOST_OFF,
   SIMCALL_HOST_GET_PROPERTIES,
-  SIMCALL_HOST_GET_CORE,
   SIMCALL_HOST_GET_PROCESS_LIST,
   SIMCALL_HOST_GET_PROCESS_LIST,
-  SIMCALL_HOST_GET_STATE,
   SIMCALL_HOST_GET_CURRENT_POWER_PEAK,
   SIMCALL_HOST_GET_POWER_PEAK_AT,
   SIMCALL_HOST_GET_NB_PSTATES,
   SIMCALL_HOST_GET_CURRENT_POWER_PEAK,
   SIMCALL_HOST_GET_POWER_PEAK_AT,
   SIMCALL_HOST_GET_NB_PSTATES,
index 168fa16..b86f5e9 100644 (file)
@@ -26,9 +26,7 @@ const char* simcall_names[] = {
   [SIMCALL_HOST_ON] = "SIMCALL_HOST_ON",
   [SIMCALL_HOST_OFF] = "SIMCALL_HOST_OFF",
   [SIMCALL_HOST_GET_PROPERTIES] = "SIMCALL_HOST_GET_PROPERTIES",
   [SIMCALL_HOST_ON] = "SIMCALL_HOST_ON",
   [SIMCALL_HOST_OFF] = "SIMCALL_HOST_OFF",
   [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_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST",
-  [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_NB_PSTATES] = "SIMCALL_HOST_GET_NB_PSTATES",
   [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",
@@ -180,21 +178,11 @@ case SIMCALL_HOST_GET_PROPERTIES:
       SIMIX_simcall_answer(simcall);
       break;  
 
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_HOST_GET_CORE:
-      simcall->result.i = SIMIX_host_get_core((sg_host_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_HOST_GET_PROCESS_LIST:
       simcall->result.dp = SIMIX_host_get_process_list((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_PROCESS_LIST:
       simcall->result.dp = SIMIX_host_get_process_list((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);
-      break;  
-
 case SIMCALL_HOST_GET_CURRENT_POWER_PEAK:
       simcall->result.d = SIMIX_host_get_current_power_peak((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
 case SIMCALL_HOST_GET_CURRENT_POWER_PEAK:
       simcall->result.d = SIMIX_host_get_current_power_peak((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
index c75f297..0149fbd 100644 (file)
@@ -49,9 +49,7 @@
 Proc - host_on (void) (host, void*, sg_host_t)
 Proc H host_off (void) (host, void*, sg_host_t)
 Func - host_get_properties (void*, xbt_dict_t) (host, void*, sg_host_t)
 Proc - host_on (void) (host, void*, sg_host_t)
 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_process_list (void*, xbt_swag_t) (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_nb_pstates (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_nb_pstates (int) (host, void*, sg_host_t)