cpp: Use #pragma once instead of #ifndef guards
[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 #pragma once
10
11 #include "rts/EventLogFormat.h"
12 #include "rts/EventLogWriter.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(const EventLogWriter *writer);
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 (uint32_t from, uint32_t 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 postUserEvent(Capability *cap, EventTypeNum type, char *msg);
49
50 void postCapMsg(Capability *cap, char *msg, va_list ap);
51
52 /*
53 * Post an event relating to a capability itself (create/delete/etc)
54 */
55 void postCapEvent (EventTypeNum tag,
56 EventCapNo capno);
57
58 /*
59 * Post an event that is associated with a capability set
60 */
61 void postCapsetEvent (EventTypeNum tag,
62 EventCapsetID capset,
63 StgWord info);
64
65 /*
66 * Post a capability set event with a string payload
67 */
68 void postCapsetStrEvent (EventTypeNum tag,
69 EventCapsetID capset,
70 char *msg);
71
72 /*
73 * Post a capability set event with several strings payload
74 */
75 void postCapsetVecEvent (EventTypeNum tag,
76 EventCapsetID capset,
77 int argc,
78 char *msg[]);
79
80 void postWallClockTime (EventCapsetID capset);
81
82 /*
83 * Post a `par` spark event
84 */
85 void postSparkEvent(Capability *cap, EventTypeNum tag, StgWord info1);
86
87 /*
88 * Post an event with several counters relating to `par` sparks.
89 */
90 void postSparkCountersEvent (Capability *cap,
91 SparkCounters counters,
92 StgWord remaining);
93
94 /*
95 * Post an event to annotate a thread with a label
96 */
97 void postThreadLabel(Capability *cap,
98 EventThreadID id,
99 char *label);
100
101 /*
102 * Various GC and heap events
103 */
104 void postHeapEvent (Capability *cap,
105 EventTypeNum tag,
106 EventCapsetID heap_capset,
107 W_ info1);
108
109 void postEventHeapInfo (EventCapsetID heap_capset,
110 uint32_t gens,
111 W_ maxHeapSize,
112 W_ allocAreaSize,
113 W_ mblockSize,
114 W_ blockSize);
115
116 void postEventGcStats (Capability *cap,
117 EventCapsetID heap_capset,
118 uint32_t gen,
119 W_ copied,
120 W_ slop,
121 W_ fragmentation,
122 uint32_t par_n_threads,
123 W_ par_max_copied,
124 W_ par_tot_copied);
125
126 void postTaskCreateEvent (EventTaskId taskId,
127 EventCapNo cap,
128 EventKernelThreadId tid);
129
130 void postTaskMigrateEvent (EventTaskId taskId,
131 EventCapNo capno,
132 EventCapNo new_capno);
133
134 void postTaskDeleteEvent (EventTaskId taskId);
135
136 void postHeapProfBegin(StgWord8 profile_id);
137
138 void postHeapProfSampleBegin(StgInt era);
139
140 void postHeapProfSampleString(StgWord8 profile_id,
141 const char *label,
142 StgWord64 residency);
143
144 #ifdef PROFILING
145 void postHeapProfCostCentre(StgWord32 ccID,
146 const char *label,
147 const char *module,
148 const char *srcloc,
149 StgBool is_caf);
150
151 void postHeapProfSampleCostCentre(StgWord8 profile_id,
152 CostCentreStack *stack,
153 StgWord64 residency);
154 #endif /* PROFILING */
155
156 #else /* !TRACING */
157
158 INLINE_HEADER void postSchedEvent (Capability *cap STG_UNUSED,
159 EventTypeNum tag STG_UNUSED,
160 StgThreadID id STG_UNUSED,
161 StgWord info1 STG_UNUSED,
162 StgWord info2 STG_UNUSED)
163 { /* nothing */ }
164
165 INLINE_HEADER void postEvent (Capability *cap STG_UNUSED,
166 EventTypeNum tag STG_UNUSED)
167 { /* nothing */ }
168
169 INLINE_HEADER void postMsg (char *msg STG_UNUSED,
170 va_list ap STG_UNUSED)
171 { /* nothing */ }
172
173 INLINE_HEADER void postCapMsg (Capability *cap STG_UNUSED,
174 char *msg STG_UNUSED,
175 va_list ap STG_UNUSED)
176 { /* nothing */ }
177
178
179 INLINE_HEADER void postThreadLabel(Capability *cap STG_UNUSED,
180 EventThreadID id STG_UNUSED,
181 char *label STG_UNUSED)
182 { /* nothing */ }
183
184 #endif
185
186 #include "EndPrivate.h"