Annotate thread stop events with the owner of the black hole
[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 #include "BeginPrivate.h"
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 void abortEventLogging(void); // #4512 - after fork child needs to abort
28 void flushEventLog(void);     // event log inherited from parent
29
30 /* 
31  * Post a scheduler event to the capability's event buffer (an event
32  * that has an associated thread).
33  */
34 void postSchedEvent(Capability *cap, EventTypeNum tag, 
35                     StgThreadID id, StgWord info1, StgWord info2);
36
37 /*
38  * Post a nullary event.
39  */
40 void postEvent(Capability *cap, EventTypeNum tag);
41
42 void postMsg(char *msg, va_list ap);
43
44 void postUserMsg(Capability *cap, char *msg, va_list ap);
45
46 void postCapMsg(Capability *cap, char *msg, va_list ap);
47
48 #else /* !TRACING */
49
50 INLINE_HEADER void postSchedEvent (Capability *cap  STG_UNUSED,
51                                    EventTypeNum tag STG_UNUSED,
52                                    StgThreadID id   STG_UNUSED,
53                                    StgWord info1    STG_UNUSED,
54                                    StgWord info2    STG_UNUSED)
55 { /* nothing */ }
56
57 INLINE_HEADER void postEvent (Capability *cap  STG_UNUSED,
58                               EventTypeNum tag STG_UNUSED)
59 { /* nothing */ }
60
61 INLINE_HEADER void postMsg (char *msg STG_UNUSED, 
62                             va_list ap STG_UNUSED)
63 { /* nothing */ }
64
65 INLINE_HEADER void postCapMsg (Capability *cap STG_UNUSED,
66                                char *msg STG_UNUSED, 
67                                va_list ap STG_UNUSED)
68 { /* nothing */ }
69
70 #endif
71
72 #include "EndPrivate.h"
73
74 #endif /* TRACING_H */