Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No more need of these ones...
[simgrid.git] / testsuite / msg / messages.h
1 /**** MSG_LICENCE DO NOT REMOVE ****/
2
3 #ifndef MESSAGES_H
4 #define MESSAGES_H
5
6 #include <stdio.h>
7 #include <stdarg.h>
8 #include "msg/datatypes.h"
9 #include "xbt/error.h"
10
11 static void DIE(const char *fmt, ...)
12 {
13   m_process_t self = MSG_process_self();
14   va_list ap;
15
16   va_start(ap, fmt);
17   if (self)
18     fprintf(stderr, "[%Lg] P%d | ", MSG_getClock(),
19             MSG_process_get_PID(self));
20   vfprintf(stderr, fmt, ap);
21   va_end(ap);
22
23   xbt_abort();
24   return;
25 }
26
27 static void PRINT_MESSAGE(const char *fmt, ...)
28 {
29 #ifdef VERBOSE
30   m_process_t self = MSG_process_self();
31   va_list ap;
32
33   va_start(ap, fmt);
34   if (self)
35     fprintf(stderr, "[%Lg] P%d | ", MSG_getClock(),
36             MSG_process_get_PID(self));
37   vfprintf(stderr, fmt, ap);
38   va_end(ap);
39 #endif
40   return;
41 }
42
43 static void PRINT_DEBUG_MESSAGE(const char *fmt, ...)
44 {
45 #ifdef VERBOSE
46   m_process_t self = MSG_process_self();
47   va_list ap;
48
49   va_start(ap, fmt);
50   if (self)
51     fprintf(stderr, "DEBUG [%Lg] P%d | ", MSG_getClock(),
52             MSG_process_get_PID(self));
53   vfprintf(stderr, fmt, ap);
54   va_end(ap);
55 #endif
56   return;
57 }
58
59 #endif