summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/InitEventLogging_c.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-09-06 05:28:56 -0400
committerBen Gamari <ben@smart-cactus.org>2019-11-22 13:45:07 -0500
commitf9f9650e142fc3ec42001b08f81509461a09aa68 (patch)
treed160d3c3dfe0ee95f367781a5cc04802f3b4ecd4 /testsuite/tests/rts/InitEventLogging_c.c
parent2f5ed225b78b32c65d023072d78ae5d176e2f04b (diff)
downloadhaskell-wip/init-eventlogging.tar.gz
rts: Expose interface for configuring EventLogWriterswip/init-eventlogging
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 'testsuite/tests/rts/InitEventLogging_c.c')
-rw-r--r--testsuite/tests/rts/InitEventLogging_c.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/rts/InitEventLogging_c.c b/testsuite/tests/rts/InitEventLogging_c.c
new file mode 100644
index 0000000000..47e4520fc4
--- /dev/null
+++ b/testsuite/tests/rts/InitEventLogging_c.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <Rts.h>
+
+void test_init(void) {
+ printf("init\n");
+}
+
+bool test_write(void *eventlog, size_t eventlog_size) {
+ printf("write\n");
+ return true;
+}
+
+void test_flush(void) {
+ printf("flush\n");
+}
+
+void test_stop(void) {
+ printf("stop\n");
+}
+
+const EventLogWriter writer = {
+ .initEventLogWriter = test_init,
+ .writeEventLog = test_write,
+ .flushEventLog = test_flush,
+ .stopEventLogWriter = test_stop
+};
+
+void init_eventlog(void) {
+ if (!startEventLogging(&writer)) {
+ printf("failed to start eventlog\n");
+ }
+}
+