03582563570371cbeb5689150ade9416f0174429
[ghc.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 #pragma GCC visibility push(hidden)
16
17 #ifdef EVENTLOG
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 void postEvent_(Capability *cap, EventTypeNum tag, StgThreadID id, StgWord64 other);
29
30 /*
31 * Post an event to the capability's event buffer.
32 */
33 INLINE_HEADER void postEvent(Capability *cap, EventTypeNum tag, StgThreadID id, StgWord64 other)
34 {
35 if (RtsFlags.EventLogFlags.doEventLogging) {
36 postEvent_(cap, tag, id, other);
37 }
38 }
39
40 void printAndClearEventLog(Capability *cap);
41
42 #else /* !EVENTLOG */
43
44 INLINE_HEADER void postEvent(Capability *cap STG_UNUSED,
45 EventTypeNum tag STG_UNUSED,
46 StgThreadID id STG_UNUSED,
47 StgWord64 other STG_UNUSED)
48 {
49 /* nothing */
50 }
51
52 #endif
53
54 #pragma GCC visibility pop
55
56 #endif /* EVENTLOG_H */