Revert "rts: add Emacs 'Local Variables' to every .c file"
[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 postEventAtTimestamp (Capability *cap, EventTimestamp ts,
44 EventTypeNum tag);
45
46 void postMsg(char *msg, va_list ap);
47
48 void postUserMsg(Capability *cap, char *msg, va_list ap);
49
50 void postCapMsg(Capability *cap, char *msg, va_list ap);
51
52 void postUserMarker(Capability *cap, char *markername);
53
54 void postEventStartup(EventCapNo n_caps);
55
56 /*
57 * Post an event relating to a capability itself (create/delete/etc)
58 */
59 void postCapEvent (EventTypeNum tag,
60 EventCapNo capno);
61
62 /*
63 * Post an event that is associated with a capability set
64 */
65 void postCapsetEvent (EventTypeNum tag,
66 EventCapsetID capset,
67 StgWord info);
68
69 /*
70 * Post a capability set event with a string payload
71 */
72 void postCapsetStrEvent (EventTypeNum tag,
73 EventCapsetID capset,
74 char *msg);
75
76 /*
77 * Post a capability set event with several strings payload
78 */
79 void postCapsetVecEvent (EventTypeNum tag,
80 EventCapsetID capset,
81 int argc,
82 char *msg[]);
83
84 void postWallClockTime (EventCapsetID capset);
85
86 /*
87 * Post a `par` spark event
88 */
89 void postSparkEvent(Capability *cap, EventTypeNum tag, StgWord info1);
90
91 /*
92 * Post an event with several counters relating to `par` sparks.
93 */
94 void postSparkCountersEvent (Capability *cap,
95 SparkCounters counters,
96 StgWord remaining);
97
98 /*
99 * Post an event to annotate a thread with a label
100 */
101 void postThreadLabel(Capability *cap,
102 EventThreadID id,
103 char *label);
104
105 /*
106 * Various GC and heap events
107 */
108 void postHeapEvent (Capability *cap,
109 EventTypeNum tag,
110 EventCapsetID heap_capset,
111 W_ info1);
112
113 void postEventHeapInfo (EventCapsetID heap_capset,
114 nat gens,
115 W_ maxHeapSize,
116 W_ allocAreaSize,
117 W_ mblockSize,
118 W_ blockSize);
119
120 void postEventGcStats (Capability *cap,
121 EventCapsetID heap_capset,
122 nat gen,
123 W_ copied,
124 W_ slop,
125 W_ fragmentation,
126 nat par_n_threads,
127 W_ par_max_copied,
128 W_ par_tot_copied);
129
130 void postTaskCreateEvent (EventTaskId taskId,
131 EventCapNo cap,
132 EventKernelThreadId tid);
133
134 void postTaskMigrateEvent (EventTaskId taskId,
135 EventCapNo capno,
136 EventCapNo new_capno);
137
138 void postTaskDeleteEvent (EventTaskId taskId);
139
140 #else /* !TRACING */
141
142 INLINE_HEADER void postSchedEvent (Capability *cap STG_UNUSED,
143 EventTypeNum tag STG_UNUSED,
144 StgThreadID id STG_UNUSED,
145 StgWord info1 STG_UNUSED,
146 StgWord info2 STG_UNUSED)
147 { /* nothing */ }
148
149 INLINE_HEADER void postEvent (Capability *cap STG_UNUSED,
150 EventTypeNum tag STG_UNUSED)
151 { /* nothing */ }
152
153 INLINE_HEADER void postMsg (char *msg STG_UNUSED,
154 va_list ap STG_UNUSED)
155 { /* nothing */ }
156
157 INLINE_HEADER void postCapMsg (Capability *cap STG_UNUSED,
158 char *msg STG_UNUSED,
159 va_list ap STG_UNUSED)
160 { /* nothing */ }
161
162
163 INLINE_HEADER void postThreadLabel(Capability *cap STG_UNUSED,
164 EventThreadID id STG_UNUSED,
165 char *label STG_UNUSED)
166 { /* nothing */ }
167
168 #endif
169
170 #include "EndPrivate.h"
171
172 #endif /* TRACING_H */