Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not free the data structures before leaving because there are issues in the implem...
[simgrid.git] / src / mc / mc_request.c
index 147af34..3aaa266 100644 (file)
@@ -54,9 +54,11 @@ char *MC_request_to_string(smx_req_t req)
     case REQ_COMM_WAIT:
       act = req->comm_wait.comm;
       type = bprintf("Wait");
-      args  = bprintf("%p [%s -> %s]", act, 
+      args  = bprintf("%p [%s(%lu) -> %s(%lu)]", act,
                       act->comm.src_proc ? act->comm.src_proc->name : "",
-                      act->comm.dst_proc ? act->comm.dst_proc->name : "");
+                      act->comm.src_proc ? act->comm.src_proc->pid : 0,
+                      act->comm.dst_proc ? act->comm.dst_proc->name : "",
+                      act->comm.dst_proc ? act->comm.dst_proc->pid : 0);
       break;
     case REQ_COMM_TEST:
       act = req->comm_test.comm;
@@ -65,11 +67,38 @@ char *MC_request_to_string(smx_req_t req)
                       act->comm.src_proc ? act->comm.src_proc->name : "",
                       act->comm.dst_proc ? act->comm.dst_proc->name : "");
       break;
+
+    case REQ_COMM_WAITANY:
+      type = bprintf("WaitAny");
+      args = bprintf("-");
+      /* FIXME: improve output */
+      break;
+
+    case REQ_COMM_TESTANY:
+       type = bprintf("TestAny");
+       args = bprintf("-");
+       /* FIXME: improve output */
+       break;
+
     default:
       THROW_UNIMPLEMENTED;
   }
-  str = bprintf("[%s] %s (%s)", req->issuer->name, type, args);
+
+  str = bprintf("[(%lu)%s] %s (%s)", req->issuer->pid ,req->issuer->name, type, args);
   xbt_free(type);
   xbt_free(args);
   return str;
-}
\ No newline at end of file
+}
+
+unsigned int MC_request_testany_fail(smx_req_t req)
+{
+  unsigned int cursor;
+  smx_action_t action;
+
+  xbt_dynar_foreach(req->comm_testany.comms, cursor, action){
+    if(action->comm.src_proc && action->comm.dst_proc)
+      return FALSE;
+  }
+
+  return TRUE;
+}