The eventlog is a stream of data printed to a location of your choice—usually a file—by the GHC runtime. It’s binary data that can be read by a zoo of different tools that are more-or-less useful for different performance-improvement tasks.
A few other links:
ThreadScope features in Simon Marlow’s book Parallel and Concurrent Programming in Haskell, which is probably where I first heard about the eventlog.
The main use case for the eventlog seems to be evaluating the behavior of parallel programs, but it also dumps data about GC events. In particular, it outputs three types of data about heap size. Unfortunately, I can’t find any good explanation about what those data are! The little blurbs I’ve found aren’t very revelatory. My notes so far:
15. Eventlog encodings — Glasgow Haskell Compiler 9.2.2 User's Guide
- Heap size, blocks size, and live:
- A HEAP_SIZE event will be emitted giving the current size of the heap, in
bytes, calculated by how many megablocks are allocated.
- A BLOCKS_SIZE event will be emitted giving the current size of the heap, in
bytes, calculated by how many blocks are allocated.
- In the case of a major collection, a HEAP_LIVE event will be emitted
describing the current size of the live on-heap data.
- -? What is a megablock?
- 11. Hints — Glasgow Haskell Compiler 9.2.2 User's Guide
- Memory is allocated firstly in the unit of megablocks which is then further divided into blocks. Block-level fragmentation is how much unused space within the allocated megablocks there is. In a fragmented heap there will be many megablocks which are only partially full.
/* The size of a block (2^BLOCK_SHIFT bytes) */
#define BLOCK_SHIFT 12
/* The size of a megablock (2^MBLOCK_SHIFT bytes) */
#define MBLOCK_SHIFT 20
- so maybe size in megablocks = amount actually requested from OS, size in blocks = amount actually allocated to data, live size = amount in blocks of live data?
#EventType(49, 'HEAP_ALLOCATED', [CapsetId, Word64], 'Total heap memory ever allocated'),
#EventType(50, 'HEAP_SIZE', [CapsetId, Word64], 'Current heap size (number of allocated mblocks)'),
#EventType(51, 'HEAP_LIVE', [CapsetId, Word64], 'Current heap live data'),
To be honest, I think the eventlog is woefully under-documented and under-utilized.