Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into mc-process
[simgrid.git] / src / mc / mc_request.c
index 9e5dcdb..ad4d1fa 100644 (file)
@@ -234,6 +234,7 @@ char *MC_request_to_string(smx_simcall_t req, int value)
 {
   char *type = NULL, *args = NULL, *str = NULL, *p = NULL, *bs = NULL;
   smx_synchro_t act = NULL;
+  smx_mutex_t mutex = NULL;
   size_t size = 0;
 
   smx_process_t issuer = MC_smx_simcall_get_issuer(req);
@@ -342,6 +343,12 @@ char *MC_request_to_string(smx_simcall_t req, int value)
     }
     break;
 
+  case SIMCALL_MUTEX_LOCK:
+    mutex = simcall_mutex_lock__get__mutex(req);
+    type = xbt_strdup("Mutex LOCK");
+    args = bprintf("locked = %d, owner = %d, sleeping = %d", mutex->locked, mutex->owner != NULL ? (int)mutex->owner->pid : -1, xbt_swag_size(mutex->sleeping));
+    break;
+
   case SIMCALL_MC_SNAPSHOT:
     type = xbt_strdup("MC_SNAPSHOT");
     args = NULL;
@@ -472,17 +479,20 @@ char *MC_request_get_dot_output(smx_simcall_t req, int value)
       else
         label = bprintf("[(%lu)] WaitTimeout", issuer->pid);
     } else {
+      // FIXME, remote access to act->comm
+      smx_process_t src_proc = MC_smx_resolve_process(act->comm.src_proc);
+      smx_process_t dst_proc = MC_smx_resolve_process(act->comm.dst_proc);
       if (issuer->smx_host)
         label =
             bprintf("[(%lu)%s] Wait [(%lu)->(%lu)]", issuer->pid,
                     MC_smx_process_get_host_name(issuer),
-                    act->comm.src_proc ? act->comm.src_proc->pid : 0,
-                    act->comm.dst_proc ? act->comm.dst_proc->pid : 0);
+                    src_proc ? src_proc->pid : 0,
+                    dst_proc ? dst_proc->pid : 0);
       else
         label =
             bprintf("[(%lu)] Wait [(%lu)->(%lu)]", issuer->pid,
-                    act->comm.src_proc ? act->comm.src_proc->pid : 0,
-                    act->comm.dst_proc ? act->comm.dst_proc->pid : 0);
+                    src_proc ? src_proc->pid : 0,
+                    dst_proc ? dst_proc->pid : 0);
     }
     break;
 
@@ -539,6 +549,10 @@ char *MC_request_get_dot_output(smx_simcall_t req, int value)
     }
     break;
 
+  case SIMCALL_MUTEX_LOCK:
+    label = bprintf("[(%lu)] Mutex LOCK", req->issuer->pid);
+    break;
+
   case SIMCALL_MC_RANDOM:
     if (issuer->smx_host)
       label =