summaryrefslogtreecommitdiff
path: root/rts/eventlog/EventLog.c
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2019-05-29 16:56:08 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2019-05-30 10:17:14 +0100
commitdb3639399db743eff1c2bde57d9219a77aa0f59a (patch)
treed44b8ffeec5bbcd3ec3271e0e124da7f8214220d /rts/eventlog/EventLog.c
parent2d2aa2031b9abc3bff7b5585ab4201948c8bba7d (diff)
downloadhaskell-wip/eventlog-heap-prof-end.tar.gz
Add HEAP_PROF_SAMPLE_END event to mark end of sampleswip/eventlog-heap-prof-end
This allows a user to observe how long a sampling period lasts so that the time taken can be removed from the profiling output. Fixes #16697
Diffstat (limited to 'rts/eventlog/EventLog.c')
-rw-r--r--rts/eventlog/EventLog.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index ff79425a4c..c853492f09 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -103,6 +103,7 @@ char *EventDesc[] = {
[EVENT_HEAP_PROF_BEGIN] = "Start of heap profile",
[EVENT_HEAP_PROF_COST_CENTRE] = "Cost center definition",
[EVENT_HEAP_PROF_SAMPLE_BEGIN] = "Start of heap profile sample",
+ [EVENT_HEAP_PROF_SAMPLE_END] = "End of heap profile sample",
[EVENT_HEAP_PROF_SAMPLE_STRING] = "Heap profile string sample",
[EVENT_HEAP_PROF_SAMPLE_COST_CENTRE] = "Heap profile cost-centre sample",
[EVENT_USER_BINARY_MSG] = "User binary message"
@@ -430,6 +431,10 @@ postHeaderEvents(void)
eventTypes[t].size = 8;
break;
+ case EVENT_HEAP_PROF_SAMPLE_END:
+ eventTypes[t].size = 8;
+ break;
+
case EVENT_HEAP_PROF_SAMPLE_STRING:
eventTypes[t].size = EVENT_SIZE_DYNAMIC;
break;
@@ -1210,6 +1215,15 @@ void postHeapProfSampleBegin(StgInt era)
RELEASE_LOCK(&eventBufMutex);
}
+void postHeapProfSampleEnd(StgInt era)
+{
+ ACQUIRE_LOCK(&eventBufMutex);
+ ensureRoomForEvent(&eventBuf, EVENT_HEAP_PROF_SAMPLE_END);
+ postEventHeader(&eventBuf, EVENT_HEAP_PROF_SAMPLE_END);
+ postWord64(&eventBuf, era);
+ RELEASE_LOCK(&eventBufMutex);
+}
+
void postHeapProfSampleString(StgWord8 profile_id,
const char *label,
StgWord64 residency)