fd87820e0892b69ccd080837455699f85c2afcd0
[ghc-hetmet.git] / rts / eventlog / EventLog.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 2008-2009
4  *
5  * Support for fast binary event logging.
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #ifndef EVENTLOG_H
10 #define EVENTLOG_H
11
12 #include "rts/EventLogFormat.h"
13 #include "Capability.h"
14
15 BEGIN_RTS_PRIVATE
16
17 #ifdef TRACING
18
19 /*
20  * Descriptions of EventTags for events.
21  */
22 extern char *EventTagDesc[];
23
24 void initEventLogging(void);
25 void endEventLogging(void);
26 void freeEventLogging(void);
27
28 /* 
29  * Post a scheduler event to the capability's event buffer (an event
30  * that has an associated thread).
31  */
32 void postSchedEvent(Capability *cap, EventTypeNum tag, 
33                     StgThreadID id, StgWord64 other);
34
35 /*
36  * Post a nullary event.
37  */
38 void postEvent(Capability *cap, EventTypeNum tag);
39
40 void postMsg(char *msg, va_list ap);
41
42 void postUserMsg(Capability *cap, char *msg, va_list ap);
43
44 void postCapMsg(Capability *cap, char *msg, va_list ap);
45
46 #else /* !TRACING */
47
48 INLINE_HEADER void postSchedEvent (Capability *cap  STG_UNUSED,
49                                    EventTypeNum tag STG_UNUSED,
50                                    StgThreadID id   STG_UNUSED,
51                                    StgWord64 other  STG_UNUSED)
52 { /* nothing */ }
53
54 INLINE_HEADER void postEvent (Capability *cap  STG_UNUSED,
55                               EventTypeNum tag STG_UNUSED)
56 { /* nothing */ }
57
58 INLINE_HEADER void postMsg (char *msg STG_UNUSED, 
59                             va_list ap STG_UNUSED)
60 { /* nothing */ }
61
62 INLINE_HEADER void postCapMsg (Capability *cap,
63                                char *msg STG_UNUSED, 
64                                va_list ap STG_UNUSED)
65 { /* nothing */ }
66
67 #endif
68
69 END_RTS_PRIVATE
70
71 #endif /* TRACING_H */