Add a way to generate tracing events programmatically
[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 an event to the capability's event buffer.
30  */
31 void postSchedEvent(Capability *cap, EventTypeNum tag, 
32                     StgThreadID id, StgWord64 other);
33
34 void postMsg(char *msg, va_list ap);
35
36 void postUserMsg(Capability *cap, char *msg);
37
38 void postCapMsg(Capability *cap, char *msg, va_list ap);
39
40 #else /* !TRACING */
41
42 INLINE_HEADER void postSchedEvent (Capability *cap  STG_UNUSED,
43                                    EventTypeNum tag STG_UNUSED,
44                                    StgThreadID id   STG_UNUSED,
45                                    StgWord64 other  STG_UNUSED)
46 { /* nothing */ }
47
48 INLINE_HEADER void postMsg (char *msg STG_UNUSED, 
49                             va_list ap STG_UNUSED)
50 { /* nothing */ }
51
52 INLINE_HEADER void postCapMsg (Capability *cap,
53                                char *msg STG_UNUSED, 
54                                va_list ap STG_UNUSED)
55 { /* nothing */ }
56
57 #endif
58
59 END_RTS_PRIVATE
60
61 #endif /* TRACING_H */