diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-09-06 05:28:56 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-11-23 18:54:41 -0500 |
commit | e43e6ece1418f84e50d572772394ab639a083e79 (patch) | |
tree | 0404fb13a6aff166b8f0561b4f40ae980d36f2bc /includes | |
parent | 8a33abfcdf5a3ae9ae1777b92891890d6a045f8b (diff) | |
download | haskell-e43e6ece1418f84e50d572772394ab639a083e79.tar.gz |
rts: Expose interface for configuring EventLogWriters
This exposes a set of interfaces from the GHC API for configuring
EventLogWriters. These can be used by consumers like
[ghc-eventlog-socket](https://github.com/bgamari/ghc-eventlog-socket).
Diffstat (limited to 'includes')
-rw-r--r-- | includes/rts/EventLogWriter.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/includes/rts/EventLogWriter.h b/includes/rts/EventLogWriter.h index 5eececd20e..4975b72b07 100644 --- a/includes/rts/EventLogWriter.h +++ b/includes/rts/EventLogWriter.h @@ -23,7 +23,7 @@ typedef struct { // Initialize an EventLogWriter (may be NULL) void (* initEventLogWriter) (void); - // Write a series of events + // Write a series of events returning true on success. bool (* writeEventLog) (void *eventlog, size_t eventlog_size); // Flush possibly existing buffers (may be NULL) @@ -38,3 +38,29 @@ typedef struct { * a file `program.eventlog`. */ extern const EventLogWriter FileEventLogWriter; + +enum EventLogStatus { + /* The runtime system wasn't compiled with eventlog support. */ + EVENTLOG_NOT_SUPPORTED, + /* An EventLogWriter has not yet been configured */ + EVENTLOG_NOT_CONFIGURED, + /* An EventLogWriter has been configured and is running. */ + EVENTLOG_RUNNING, +}; + +/* + * Query whether the current runtime system supports eventlogging. + */ +enum EventLogStatus eventLogStatus(void); + +/* + * Initialize event logging using the given EventLogWriter. + * Returns true on success or false if an EventLogWriter is already configured + * or eventlogging isn't supported by the runtime. + */ +bool startEventLogging(const EventLogWriter *writer); + +/* + * Stop event logging and destroy the current EventLogWriter. + */ +void endEventLogging(void); |