Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
frame a concept of execution, that will become a s4u::Async
[simgrid.git] / src / simix / smx_process.cpp
index 46d0fbd..6078923 100644 (file)
@@ -13,6 +13,7 @@
 #include "src/mc/mc_replay.h"
 #include "src/mc/mc_client.h"
 #include "src/simix/smx_private.hpp"
+#include "src/msg/msg_private.h"
 
 #ifdef HAVE_SMPI
 #include "src/smpi/private.h"
@@ -58,7 +59,7 @@ void SIMIX_process_cleanup(smx_process_t process)
 
   /* Unregister from the kill timer if any */
   if (process->kill_timer != NULL)
-         SIMIX_timer_remove(process->kill_timer);
+      SIMIX_timer_remove(process->kill_timer);
 
   xbt_os_mutex_acquire(simix_global->mutex);
 
@@ -167,7 +168,7 @@ void SIMIX_process_stop(smx_process_t arg) {
   /* execute the on_exit functions */
   SIMIX_process_on_exit_runall(arg);
   /* Add the process to the list of process to restart, only if the host is down */
-  if (arg->auto_restart && arg->host->isOff()) {
+  if (arg->auto_restart && arg->host->is_off()) {
     SIMIX_host_add_auto_restart_process(arg->host,arg->name,arg->code, arg->data,
                                         sg_host_get_name(arg->host),
                                         SIMIX_timer_get_date(arg->kill_timer),
@@ -246,7 +247,7 @@ smx_process_t SIMIX_process_create(
 
   XBT_DEBUG("Start process %s on host '%s'", name, hostname);
 
-  if (host->isOff()) {
+  if (host->is_off()) {
     int i;
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name,
           hostname);
@@ -320,6 +321,9 @@ smx_process_t SIMIX_process_create(
           sg_host_get_name(process->host), kill_time);
       process->kill_timer = SIMIX_timer_set(kill_time, kill_process, process);
     }
+
+    /* Tracing the process creation */
+    TRACE_msg_process_create(process->name, process->pid, process->host);
   }
   return process;
 }
@@ -371,7 +375,7 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) {
 
     case SIMIX_SYNC_EXECUTE:
     case SIMIX_SYNC_PARALLEL_EXECUTE:
-      SIMIX_process_execution_destroy(process->waiting_synchro);
+      SIMIX_execution_destroy(process->waiting_synchro);
       break;
 
     case SIMIX_SYNC_COMMUNICATE:
@@ -428,7 +432,7 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con
 
     case SIMIX_SYNC_EXECUTE:
     case SIMIX_SYNC_PARALLEL_EXECUTE:
-      SIMIX_process_execution_cancel(process->waiting_synchro);
+      SIMIX_execution_cancel(process->waiting_synchro);
       break;
 
     case SIMIX_SYNC_COMMUNICATE:
@@ -508,7 +512,7 @@ void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_process_t proces
   } else {
     xbt_fifo_push(sync_suspend->simcalls, simcall);
     process->waiting_synchro = sync_suspend;
-    SIMIX_host_execution_suspend(process->waiting_synchro);
+    SIMIX_execution_suspend(process->waiting_synchro);
   }
   /* If we are suspending ourselves, then just do not finish the simcall now */
 }
@@ -534,7 +538,7 @@ smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
 
         case SIMIX_SYNC_EXECUTE:
         case SIMIX_SYNC_PARALLEL_EXECUTE:
-          SIMIX_host_execution_suspend(process->waiting_synchro);
+          SIMIX_execution_suspend(process->waiting_synchro);
           break;
 
         case SIMIX_SYNC_COMMUNICATE:
@@ -560,7 +564,7 @@ smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
     }
   } else {
     /* FIXME: computation size is zero. Is it okay that bound is zero ? */
-    return SIMIX_process_execute(process, "suspend", 0.0, 1.0, 0.0, 0);
+    return SIMIX_execution_start(process, "suspend", 0.0, 1.0, 0.0, 0);
   }
 }
 
@@ -590,7 +594,7 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer)
 
         case SIMIX_SYNC_EXECUTE:
         case SIMIX_SYNC_PARALLEL_EXECUTE:
-          SIMIX_host_execution_resume(process->waiting_synchro);
+          SIMIX_execution_resume(process->waiting_synchro);
           break;
 
         case SIMIX_SYNC_COMMUNICATE:
@@ -681,7 +685,7 @@ const char* SIMIX_process_self_get_name(void) {
 
   smx_process_t process = SIMIX_process_self();
   if (process == NULL || process == simix_global->maestro_process)
-    return "";
+    return "maestro";
 
   return SIMIX_process_get_name(process);
 }
@@ -769,7 +773,7 @@ smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration)
   sg_host_t host = process->host;
 
   /* check if the host is active */
-  if (host->isOff()) {
+  if (host->is_off()) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -811,7 +815,7 @@ void SIMIX_post_process_sleep(smx_synchro_t synchro)
         THROW_IMPOSSIBLE;
         break;
     }
-    if (simcall->issuer->host->isOff()) {
+    if (simcall->issuer->host->is_off()) {
       simcall->issuer->context->iwannadie = 1;
     }
     simcall_process_sleep__set__result(simcall, state);