Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
populate simix::Exec ctor
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 26 May 2016 07:38:54 +0000 (09:38 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 26 May 2016 07:38:54 +0000 (09:38 +0200)
src/simix/SynchroExec.cpp
src/simix/SynchroExec.hpp
src/simix/smx_host.cpp

index 3b0f2c8..ddd7fc9 100644 (file)
@@ -7,6 +7,12 @@
 #include "src/surf/surf_interface.hpp"
 #include "src/simix/smx_host_private.h"
 
+simgrid::simix::Exec::Exec(const char*name, sg_host_t hostarg)
+{
+  name = xbt_strdup(name);
+  state = SIMIX_RUNNING;
+  host = hostarg;
+}
 simgrid::simix::Exec::~Exec()
 {
   if (surf_exec)
index 20d26f8..58951ce 100644 (file)
@@ -15,13 +15,14 @@ namespace simix {
   XBT_PUBLIC_CLASS Exec : public Synchro {
     ~Exec();
   public:
+    Exec(const char*name, sg_host_t host);
     void suspend() override;
     void resume() override;
     void post() override;
     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. If NULL, then this is a parallel exec (and only surf knows the hosts) */
+    surf_action_t surf_exec=nullptr;/* The Surf execution action encapsulated */
   };
 
 }} // namespace simgrid::simix
index 3127082..d1d5ddb 100644 (file)
@@ -220,10 +220,7 @@ smx_synchro_t SIMIX_execution_start(smx_process_t issuer, const char *name,
      double flops_amount, double priority, double bound, unsigned long affinity_mask){
 
   /* alloc structures and initialize */
-  simgrid::simix::Exec *exec = new simgrid::simix::Exec();
-  exec->name = xbt_strdup(name);
-  exec->state = SIMIX_RUNNING;
-  exec->host = issuer->host;
+  simgrid::simix::Exec *exec = new simgrid::simix::Exec(name, issuer->host);
 
   /* set surf's action */
   if (!MC_is_active() && !MC_record_replay_is_active()) {
@@ -257,10 +254,7 @@ smx_synchro_t SIMIX_execution_parallel_start(const char *name,
   int i;
 
   /* alloc structures and initialize */
-  simgrid::simix::Exec *exec = new simgrid::simix::Exec();
-  exec->name = xbt_strdup(name);
-  exec->state = SIMIX_RUNNING;
-  exec->host = nullptr; /* FIXME: do we need the list of hosts? */
+  simgrid::simix::Exec *exec = new simgrid::simix::Exec(name, nullptr);
 
   /* set surf's synchro */
   host_list_cpy = xbt_new0(sg_host_t, host_nb);