Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Those files already are in examples.
[simgrid.git] / testsuite / msg / messages.h
index 0ec66bf..02770d5 100644 (file)
 #include "msg/datatypes.h"
 #include "xbt/error.h"
 
+static void ASSERT(int value, const char *fmt, ...)
+{
+  m_process_t self = MSG_process_self();
+  va_list ap;
+
+  if(!value) {
+    va_start(ap, fmt);
+    if (self)
+      fprintf(stderr, "[%Lg] P%d | ", MSG_getClock(),
+             MSG_process_get_PID(self));
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+    
+    xbt_abort();
+  }
+  return;
+}
+
 static void DIE(const char *fmt, ...)
 {
   m_process_t self = MSG_process_self();
@@ -37,8 +55,8 @@ static void PRINT_MESSAGE(const char *fmt, ...)
 
   va_start(ap, fmt);
   if (self)
-    fprintf(stderr, "[%Lg] P%d | ", MSG_getClock(),
-           MSG_process_get_PID(self));
+    fprintf(stderr, "[%Lg] P%d | (%s:%s) ", MSG_getClock(),
+           MSG_process_get_PID(self), MSG_host_self()->name, self->name);
   vfprintf(stderr, fmt, ap);
   va_end(ap);
 #endif
@@ -53,8 +71,8 @@ static void PRINT_DEBUG_MESSAGE(const char *fmt, ...)
 
   va_start(ap, fmt);
   if (self)
-    fprintf(stderr, "DEBUG [%Lg] P%d | ", MSG_getClock(),
-           MSG_process_get_PID(self));
+    fprintf(stderr, "DEBUG [%Lg] P%d | (%s) ", MSG_getClock(),
+           MSG_process_get_PID(self), MSG_host_self()->name);
   vfprintf(stderr, fmt, ap);
   va_end(ap);
 #endif