diff options
| author | alexbiehl <alex.biehl@gmail.com> | 2017-01-31 16:06:33 -0500 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2017-01-31 18:50:21 -0500 |
| commit | 4dfc6d1c40b298d4b8f136e46420227eda60a03d (patch) | |
| tree | fce2d978323653ff0ff989fdb72f3585be5b4de4 /includes/rts | |
| parent | 44f079f74869d8cb417e2dcc104517ae7f593e5f (diff) | |
| download | haskell-4dfc6d1c40b298d4b8f136e46420227eda60a03d.tar.gz | |
Abstract over the way eventlogs are flushed
Currently eventlog data is always written to a file `progname.eventlog`.
This patch introduces the `flushEventLog` field in `RtsConfig` which
allows to customize the writing of eventlog data.
One possible scenario is the ongoing live-profile-monitor effort by
@NCrashed which slurps all eventlog data through `fluchEventLog`.
`flushEventLog` takes a buffer with eventlog data and its size and
returns `false` (0) in case eventlog data could not be procesed.
Reviewers: simonmar, austin, erikd, bgamari
Reviewed By: simonmar, bgamari
Subscribers: qnikst, thomie, NCrashed
Differential Revision: https://phabricator.haskell.org/D2934
Diffstat (limited to 'includes/rts')
| -rw-r--r-- | includes/rts/EventLogWriter.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/includes/rts/EventLogWriter.h b/includes/rts/EventLogWriter.h new file mode 100644 index 0000000000..f9cb25fe62 --- /dev/null +++ b/includes/rts/EventLogWriter.h @@ -0,0 +1,40 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The GHC Team, 2008-2017 + * + * Support for fast binary event logging. + * + * ---------------------------------------------------------------------------*/ + +#ifndef EVENTLOG_WRITER_H +#define EVENTLOG_WRITER_H + +#include <stddef.h> +#include <stdbool.h> + +#include "Rts.h" + +/* + * Abstraction for writing eventlog data. + */ +typedef struct { + // Initialize an EventLogWriter (may be NULL) + void (* initEventLogWriter) (void); + + // Write a series of events + bool (* writeEventLog) (void *eventlog, size_t eventlog_size); + + // Flush possibly existing buffers (may be NULL) + void (* flushEventLog) (void); + + // Close an initialized EventLogOutput (may be NULL) + void (* stopEventLogWriter) (void); +} EventLogWriter; + +/* + * An EventLogWriter which writes eventlogs to + * a file `program.eventlog`. + */ +extern const EventLogWriter FileEventLogWriter; + +#endif /* EVENTLOG_WRITER_H */ |
