Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simix: change two more getter simcalls into methods
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 9 May 2016 15:25:43 +0000 (17:25 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 9 May 2016 15:25:43 +0000 (17:25 +0200)
12 files changed:
include/simgrid/simix.h
src/msg/msg_task.cpp
src/simix/SynchroExec.cpp
src/simix/SynchroExec.hpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_host.cpp
src/simix/smx_host_private.h

index 0cfad7f..cf5f064 100644 (file)
@@ -283,8 +283,6 @@ XBT_PUBLIC(smx_synchro_t) simcall_execution_parallel_start(const char *name,
                                                      double rate);
 XBT_PUBLIC(void) simcall_execution_destroy(smx_synchro_t execution);
 XBT_PUBLIC(void) simcall_execution_cancel(smx_synchro_t execution);
                                                      double rate);
 XBT_PUBLIC(void) simcall_execution_destroy(smx_synchro_t execution);
 XBT_PUBLIC(void) simcall_execution_cancel(smx_synchro_t execution);
-XBT_PUBLIC(double) simcall_execution_get_remains(smx_synchro_t execution);
-XBT_PUBLIC(e_smx_state_t) simcall_execution_get_state(smx_synchro_t execution);
 XBT_PUBLIC(void) simcall_execution_set_priority(smx_synchro_t execution, double priority);
 XBT_PUBLIC(void) simcall_execution_set_bound(smx_synchro_t execution, double bound);
 XBT_PUBLIC(void) simcall_execution_set_affinity(smx_synchro_t execution, sg_host_t host, unsigned long mask);
 XBT_PUBLIC(void) simcall_execution_set_priority(smx_synchro_t execution, double priority);
 XBT_PUBLIC(void) simcall_execution_set_bound(smx_synchro_t execution, double bound);
 XBT_PUBLIC(void) simcall_execution_set_affinity(smx_synchro_t execution, sg_host_t host, unsigned long mask);
index 33a386e..4910856 100644 (file)
@@ -252,7 +252,7 @@ msg_error_t MSG_task_cancel(msg_task_t task)
  */
 double MSG_task_get_flops_amount(msg_task_t task) {
   if (task->simdata->compute) {
  */
 double MSG_task_get_flops_amount(msg_task_t task) {
   if (task->simdata->compute) {
-    return simcall_execution_get_remains(task->simdata->compute);
+    return task->simdata->compute->remains();
   } else {
     return task->simdata->flops_amount;
   }
   } else {
     return task->simdata->flops_amount;
   }
index db79ea0..6dfa770 100644 (file)
@@ -17,3 +17,11 @@ void simgrid::simix::Exec::resume()
   if (surf_exec)
     surf_exec->resume();
 }
   if (surf_exec)
     surf_exec->resume();
 }
+
+double simgrid::simix::Exec::remains()
+{
+  if (state == SIMIX_RUNNING)
+    return surf_exec->getRemains();
+
+  return 0;
+}
index c81b6b7..d24af4f 100644 (file)
@@ -16,6 +16,7 @@ namespace simix {
   public:
     void suspend();
     void resume();
   public:
     void suspend();
     void resume();
+    double remains();
 
     sg_host_t host;                /* The host where the execution takes place */
     surf_action_t surf_exec;        /* The Surf execution action encapsulated */
 
     sg_host_t host;                /* The host where the execution takes place */
     surf_action_t surf_exec;        /* The Surf execution action encapsulated */
index f15f002..b1563f0 100644 (file)
@@ -149,30 +149,6 @@ void simcall_execution_cancel(smx_synchro_t execution)
   simcall_BODY_execution_cancel(execution);
 }
 
   simcall_BODY_execution_cancel(execution);
 }
 
-/**
- * \ingroup simix_process_management
- * \brief Returns how much of an execution synchro remains to be done.
- *
- * \param execution The execution synchro
- * \return The remaining amount
- */
-double simcall_execution_get_remains(smx_synchro_t execution)
-{
-  return simcall_BODY_execution_get_remains(execution);
-}
-
-/**
- * \ingroup simix_process_management
- * \brief Returns the state of an execution synchro.
- *
- * \param execution The execution synchro
- * \return The state
- */
-e_smx_state_t simcall_execution_get_state(smx_synchro_t execution)
-{
-  return simcall_BODY_execution_get_state(execution);
-}
-
 /**
  * \ingroup simix_process_management
  * \brief Changes the priority of an execution synchro.
 /**
  * \ingroup simix_process_management
  * \brief Changes the priority of an execution synchro.
index c694b14..f91ec83 100644 (file)
@@ -303,32 +303,6 @@ static inline void simcall_execution_cancel__set__execution(smx_simcall_t simcal
     simcall->args[0].dp = arg;
 }
 
     simcall->args[0].dp = arg;
 }
 
-static inline smx_synchro_t simcall_execution_get_remains__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_execution_get_remains__get__result(smx_simcall_t simcall){
-    return  simcall->result.d;
-}
-static inline void simcall_execution_get_remains__set__result(smx_simcall_t simcall, double result){
-    simcall->result.d = result;
-}
-
-static inline smx_synchro_t simcall_execution_get_state__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_execution_get_state__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline e_smx_state_t simcall_execution_get_state__get__result(smx_simcall_t simcall){
-    return (e_smx_state_t) simcall->result.i;
-}
-static inline void simcall_execution_get_state__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
-}
-
 static inline smx_synchro_t simcall_execution_set_priority__get__execution(smx_simcall_t simcall) {
   return (smx_synchro_t) simcall->args[0].dp;
 }
 static inline smx_synchro_t simcall_execution_set_priority__get__execution(smx_simcall_t simcall) {
   return (smx_synchro_t) simcall->args[0].dp;
 }
index 4c1e438..0b3bf05 100644 (file)
@@ -437,48 +437,6 @@ inline static void simcall_BODY_execution_cancel(smx_synchro_t execution) {
     
   }
   
     
   }
   
-inline static double simcall_BODY_execution_get_remains(smx_synchro_t execution) {
-    smx_process_t self = SIMIX_process_self();
-
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_execution_get_remains(execution);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_GET_REMAINS;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    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 (double) self->simcall.result.d;
-  }
-  
-inline static e_smx_state_t simcall_BODY_execution_get_state(smx_synchro_t execution) {
-    smx_process_t self = SIMIX_process_self();
-
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_execution_get_state(execution);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_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*) execution;
-    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 (e_smx_state_t) self->simcall.result.i;
-  }
-  
 inline static void simcall_BODY_execution_set_priority(smx_synchro_t execution, double priority) {
     smx_process_t self = SIMIX_process_self();
 
 inline static void simcall_BODY_execution_set_priority(smx_synchro_t execution, double priority) {
     smx_process_t self = SIMIX_process_self();
 
index fca277b..3da7977 100644 (file)
@@ -37,8 +37,6 @@ typedef enum {
   SIMCALL_EXECUTION_PARALLEL_START,
   SIMCALL_EXECUTION_DESTROY,
   SIMCALL_EXECUTION_CANCEL,
   SIMCALL_EXECUTION_PARALLEL_START,
   SIMCALL_EXECUTION_DESTROY,
   SIMCALL_EXECUTION_CANCEL,
-  SIMCALL_EXECUTION_GET_REMAINS,
-  SIMCALL_EXECUTION_GET_STATE,
   SIMCALL_EXECUTION_SET_PRIORITY,
   SIMCALL_EXECUTION_SET_BOUND,
   SIMCALL_EXECUTION_SET_AFFINITY,
   SIMCALL_EXECUTION_SET_PRIORITY,
   SIMCALL_EXECUTION_SET_BOUND,
   SIMCALL_EXECUTION_SET_AFFINITY,
index 5e9e1e0..d73d798 100644 (file)
@@ -42,8 +42,6 @@ const char* simcall_names[] = {
   "SIMCALL_EXECUTION_PARALLEL_START",
   "SIMCALL_EXECUTION_DESTROY",
   "SIMCALL_EXECUTION_CANCEL",
   "SIMCALL_EXECUTION_PARALLEL_START",
   "SIMCALL_EXECUTION_DESTROY",
   "SIMCALL_EXECUTION_CANCEL",
-  "SIMCALL_EXECUTION_GET_REMAINS",
-  "SIMCALL_EXECUTION_GET_STATE",
   "SIMCALL_EXECUTION_SET_PRIORITY",
   "SIMCALL_EXECUTION_SET_BOUND",
   "SIMCALL_EXECUTION_SET_AFFINITY",
   "SIMCALL_EXECUTION_SET_PRIORITY",
   "SIMCALL_EXECUTION_SET_BOUND",
   "SIMCALL_EXECUTION_SET_AFFINITY",
@@ -205,16 +203,6 @@ case SIMCALL_EXECUTION_CANCEL:
       SIMIX_simcall_answer(simcall);
       break;  
 
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_EXECUTION_GET_REMAINS:
-      simcall->result.d = SIMIX_execution_get_remains((smx_synchro_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_EXECUTION_GET_STATE:
-      simcall->result.i = SIMIX_execution_get_state((smx_synchro_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_EXECUTION_SET_PRIORITY:
        SIMIX_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
       SIMIX_simcall_answer(simcall);
 case SIMCALL_EXECUTION_SET_PRIORITY:
        SIMIX_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
       SIMIX_simcall_answer(simcall);
index 8e2315c..b345e4f 100644 (file)
@@ -67,8 +67,6 @@ Func H execution_start (void*, smx_synchro_t) (name, const char*) (flops_amount,
 Func - execution_parallel_start (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, sg_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double)
 Proc - execution_destroy (void) (execution, void*, smx_synchro_t)
 Proc - execution_cancel (void) (execution, void*, smx_synchro_t)
 Func - execution_parallel_start (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, sg_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double)
 Proc - execution_destroy (void) (execution, void*, smx_synchro_t)
 Proc - execution_cancel (void) (execution, void*, smx_synchro_t)
-Func - execution_get_remains (double) (execution, void*, smx_synchro_t)
-Func - execution_get_state (int, e_smx_state_t) (execution, void*, smx_synchro_t)
 Proc - execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double)
 Proc - execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double)
 Proc - execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, sg_host_t) (mask, unsigned long)
 Proc - execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double)
 Proc - execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double)
 Proc - execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, sg_host_t) (mask, unsigned long)
index 2115a80..4b4b325 100644 (file)
@@ -353,22 +353,6 @@ void SIMIX_execution_cancel(smx_synchro_t synchro)
     exec->surf_exec->cancel();
 }
 
     exec->surf_exec->cancel();
 }
 
-double SIMIX_execution_get_remains(smx_synchro_t synchro)
-{
-  double result = 0.0;
-  simgrid::simix::Exec *exec = static_cast<simgrid::simix::Exec *>(synchro);
-
-  if (synchro->state == SIMIX_RUNNING)
-    result = exec->surf_exec->getRemains();
-
-  return result;
-}
-
-e_smx_state_t SIMIX_execution_get_state(smx_synchro_t synchro)
-{
-  return synchro->state;
-}
-
 void SIMIX_execution_set_priority(smx_synchro_t synchro, double priority)
 {
   simgrid::simix::Exec *exec = static_cast<simgrid::simix::Exec *>(synchro);
 void SIMIX_execution_set_priority(smx_synchro_t synchro, double priority)
 {
   simgrid::simix::Exec *exec = static_cast<simgrid::simix::Exec *>(synchro);
index 8393d9a..312e5bd 100644 (file)
@@ -45,8 +45,6 @@ XBT_PRIVATE smx_synchro_t SIMIX_execution_parallel_start(const char *name,
     double amount, double rate);
 XBT_PRIVATE void SIMIX_execution_destroy(smx_synchro_t synchro);
 XBT_PRIVATE void SIMIX_execution_cancel(smx_synchro_t synchro);
     double amount, double rate);
 XBT_PRIVATE void SIMIX_execution_destroy(smx_synchro_t synchro);
 XBT_PRIVATE void SIMIX_execution_cancel(smx_synchro_t synchro);
-XBT_PRIVATE double SIMIX_execution_get_remains(smx_synchro_t synchro);
-XBT_PRIVATE e_smx_state_t SIMIX_execution_get_state(smx_synchro_t synchro);
 XBT_PRIVATE void SIMIX_execution_set_priority(smx_synchro_t synchro, double priority);
 XBT_PRIVATE void SIMIX_execution_set_bound(smx_synchro_t synchro, double bound);
 XBT_PRIVATE void SIMIX_execution_set_affinity(smx_synchro_t synchro, sg_host_t host, unsigned long mask);
 XBT_PRIVATE void SIMIX_execution_set_priority(smx_synchro_t synchro, double priority);
 XBT_PRIVATE void SIMIX_execution_set_bound(smx_synchro_t synchro, double bound);
 XBT_PRIVATE void SIMIX_execution_set_affinity(smx_synchro_t synchro, sg_host_t host, unsigned long mask);