Allow the number of capabilities to be increased at runtime (#3729)
[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 #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 void moreCapEventBufs (nat from, nat to);
30
31 /*
32 * Post a scheduler event to the capability's event buffer (an event
33 * that has an associated thread).
34 */
35 void postSchedEvent(Capability *cap, EventTypeNum tag,
36 StgThreadID id, StgWord info1, StgWord info2);
37
38 /*
39 * Post a nullary event.
40 */
41 void postEvent(Capability *cap, EventTypeNum tag);
42
43 void postMsg(char *msg, va_list ap);
44
45 void postUserMsg(Capability *cap, char *msg, va_list ap);
46
47 void postCapMsg(Capability *cap, char *msg, va_list ap);
48
49 void postEventStartup(EventCapNo n_caps);
50
51 /*
52 * Post an event that is associated with a capability set
53 */
54 void postCapsetEvent (EventTypeNum tag,
55 EventCapsetID capset,
56 StgWord info);
57
58 /*
59 * Post a capability set event with a string payload
60 */
61 void postCapsetStrEvent (EventTypeNum tag,
62 EventCapsetID capset,
63 char *msg);
64
65 /*
66 * Post a capability set event with several strings payload
67 */
68 void postCapsetVecEvent (EventTypeNum tag,
69 EventCapsetID capset,
70 int argc,
71 char *msg[]);
72
73 void postWallClockTime (EventCapsetID capset);
74
75 /*
76 * Post a `par` spark event
77 */
78 void postSparkEvent(Capability *cap, EventTypeNum tag, StgWord info1);
79
80 /*
81 * Post an event with several counters relating to `par` sparks.
82 */
83 void postSparkCountersEvent (Capability *cap,
84 SparkCounters counters,
85 StgWord remaining);
86
87 /*
88 * Post an event to annotate a thread with a label
89 */
90 void postThreadLabel(Capability *cap,
91 EventThreadID id,
92 char *label);
93
94 #else /* !TRACING */
95
96 INLINE_HEADER void postSchedEvent (Capability *cap STG_UNUSED,
97 EventTypeNum tag STG_UNUSED,
98 StgThreadID id STG_UNUSED,
99 StgWord info1 STG_UNUSED,
100 StgWord info2 STG_UNUSED)
101 { /* nothing */ }
102
103 INLINE_HEADER void postEvent (Capability *cap STG_UNUSED,
104 EventTypeNum tag STG_UNUSED)
105 { /* nothing */ }
106
107 INLINE_HEADER void postMsg (char *msg STG_UNUSED,
108 va_list ap STG_UNUSED)
109 { /* nothing */ }
110
111 INLINE_HEADER void postCapMsg (Capability *cap STG_UNUSED,
112 char *msg STG_UNUSED,
113 va_list ap STG_UNUSED)
114 { /* nothing */ }
115
116
117 INLINE_HEADER void postThreadLabel(Capability *cap STG_UNUSED,
118 EventThreadID id STG_UNUSED,
119 char *label STG_UNUSED)
120 { /* nothing */ }
121
122 #endif
123
124 #include "EndPrivate.h"
125
126 #endif /* TRACING_H */