summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorMitsutoshi Aoe <maoe@foldr.in>2018-08-21 16:08:17 -0400
committerBen Gamari <ben@smart-cactus.org>2018-08-21 18:56:12 -0400
commit21f0f56164f50844c2150c62f950983b2376f8b6 (patch)
tree998c56ef1553695f0134d4797767503576fe8132 /includes
parent8546afc502306de16b62c6386fe419753393cb12 (diff)
downloadhaskell-21f0f56164f50844c2150c62f950983b2376f8b6.tar.gz
Add traceBinaryEvent# primop
This adds a new primop called traceBinaryEvent# that takes the length of binary data and a pointer to the data, then emits it to the eventlog. There is some example code that uses this primop and the new event: * [traceBinaryEventIO][1] that calls `traceBinaryEvent#` * [A patch to ghc-events][2] that parses the new `EVENT_USER_BINARY_MSG` There's no corresponding issue on Trac but it was discussed at ghc-devs [3]. [1] https://github.com/maoe/ghc-trace-events/blob /fb226011ef1f85a97b4da7cc9d5f98f9fe6316ae/src/Debug/Trace/Binary.hs#L29) [2] https://github.com/maoe/ghc-events/commit /239ca77c24d18cdd10d6d85a0aef98e4a7c56ae6) [3] https://mail.haskell.org/pipermail/ghc-devs/2018-May/015791.html Reviewers: bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D5007
Diffstat (limited to 'includes')
-rw-r--r--includes/rts/EventLogFormat.h6
-rw-r--r--includes/stg/MiscClosures.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
index ccfe03b5a5..63303c93b7 100644
--- a/includes/rts/EventLogFormat.h
+++ b/includes/rts/EventLogFormat.h
@@ -178,12 +178,15 @@
#define EVENT_HEAP_PROF_SAMPLE_BEGIN 162
#define EVENT_HEAP_PROF_SAMPLE_COST_CENTRE 163
#define EVENT_HEAP_PROF_SAMPLE_STRING 164
+
+#define EVENT_USER_BINARY_MSG 181
+
/*
* The highest event code +1 that ghc itself emits. Note that some event
* ranges higher than this are reserved but not currently emitted by ghc.
* This must match the size of the EventDesc[] array in EventLog.c
*/
-#define NUM_GHC_EVENT_TAGS 165
+#define NUM_GHC_EVENT_TAGS 182
#if 0 /* DEPRECATED EVENTS: */
/* we don't actually need to record the thread, it's implicit */
@@ -257,4 +260,5 @@ typedef StgWord16 EventCapsetType; /* types for EVENT_CAPSET_CREATE */
typedef StgWord64 EventTaskId; /* for EVENT_TASK_* */
typedef StgWord64 EventKernelThreadId; /* for EVENT_TASK_CREATE */
+#define EVENT_PAYLOAD_SIZE_MAX STG_WORD16_MAX
#endif
diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
index 6ae3df1390..5328ed3f4a 100644
--- a/includes/stg/MiscClosures.h
+++ b/includes/stg/MiscClosures.h
@@ -479,6 +479,7 @@ RTS_FUN_DECL(stg_noDuplicatezh);
RTS_FUN_DECL(stg_traceCcszh);
RTS_FUN_DECL(stg_clearCCSzh);
RTS_FUN_DECL(stg_traceEventzh);
+RTS_FUN_DECL(stg_traceBinaryEventzh);
RTS_FUN_DECL(stg_traceMarkerzh);
RTS_FUN_DECL(stg_getThreadAllocationCounterzh);
RTS_FUN_DECL(stg_setThreadAllocationCounterzh);