summaryrefslogtreecommitdiff
path: root/rts/eventlog
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-02-26 16:08:18 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-08 07:32:15 -0500
commitffc9643986bc83429c78910135614e830a131a7d (patch)
treed230aacf66f588a85b21e4392343a98fa3297601 /rts/eventlog
parent33a4fd9939f8fc8e9ba4e61041270353f51ae55e (diff)
downloadhaskell-ffc9643986bc83429c78910135614e830a131a7d.tar.gz
eventlog: Add BLOCKS_SIZE event
The BLOCKS_SIZE event reports the size of the currently allocated blocks in bytes. It is like the HEAP_SIZE event, but reports about the blocks rather than megablocks. You can work out the current heap fragmentation by looking at the difference between HEAP_SIZE and BLOCKS_SIZE. Fixes #19357
Diffstat (limited to 'rts/eventlog')
-rw-r--r--rts/eventlog/EventLog.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index 237c9bad9d..ebb44a7c9e 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -132,7 +132,8 @@ char *EventDesc[] = {
[EVENT_MEM_RETURN] = "Memory return statistics",
[EVENT_HEAP_INFO_GHC] = "Heap static parameters",
[EVENT_HEAP_ALLOCATED] = "Total heap mem ever allocated",
- [EVENT_HEAP_SIZE] = "Current heap size",
+ [EVENT_HEAP_SIZE] = "Current heap size (size of allocated mblocks)",
+ [EVENT_BLOCKS_SIZE] = "Current heap size (size of allocated blocks)",
[EVENT_HEAP_LIVE] = "Current heap live data",
[EVENT_CREATE_SPARK_THREAD] = "Create spark thread",
[EVENT_LOG_MSG] = "Log message",
@@ -443,6 +444,7 @@ init_event_types(void)
case EVENT_HEAP_ALLOCATED: // (heap_capset, alloc_bytes)
case EVENT_HEAP_SIZE: // (heap_capset, size_bytes)
+ case EVENT_BLOCKS_SIZE: // (heap_capset, size_bytes)
case EVENT_HEAP_LIVE: // (heap_capset, live_bytes)
eventTypes[t].size = sizeof(EventCapsetID) + sizeof(StgWord64);
break;
@@ -1099,6 +1101,7 @@ void postHeapEvent (Capability *cap,
switch (tag) {
case EVENT_HEAP_ALLOCATED: // (heap_capset, alloc_bytes)
case EVENT_HEAP_SIZE: // (heap_capset, size_bytes)
+ case EVENT_BLOCKS_SIZE: // (heap_capset, size_bytes)
case EVENT_HEAP_LIVE: // (heap_capset, live_bytes)
{
postCapsetID(eb, heap_capset);