f9cb25fe623d25423932182fdd09f79642ce1046
[ghc.git] / includes / rts / EventLogWriter.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2008-2017
4 *
5 * Support for fast binary event logging.
6 *
7 * ---------------------------------------------------------------------------*/
8
9 #ifndef EVENTLOG_WRITER_H
10 #define EVENTLOG_WRITER_H
11
12 #include <stddef.h>
13 #include <stdbool.h>
14
15 #include "Rts.h"
16
17 /*
18 * Abstraction for writing eventlog data.
19 */
20 typedef struct {
21 // Initialize an EventLogWriter (may be NULL)
22 void (* initEventLogWriter) (void);
23
24 // Write a series of events
25 bool (* writeEventLog) (void *eventlog, size_t eventlog_size);
26
27 // Flush possibly existing buffers (may be NULL)
28 void (* flushEventLog) (void);
29
30 // Close an initialized EventLogOutput (may be NULL)
31 void (* stopEventLogWriter) (void);
32 } EventLogWriter;
33
34 /*
35 * An EventLogWriter which writes eventlogs to
36 * a file `program.eventlog`.
37 */
38 extern const EventLogWriter FileEventLogWriter;
39
40 #endif /* EVENTLOG_WRITER_H */