diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2019-10-09 14:32:13 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-23 05:58:58 -0400 |
commit | 17987a4b665d4a270b1bebba1f61d67887f2653c (patch) | |
tree | 922a01003b495c1a0cdf9457f7ecbb4985e20578 /docs | |
parent | b521e8b698cc415684fbc0ea5ddfab51077cb144 (diff) | |
download | haskell-17987a4b665d4a270b1bebba1f61d67887f2653c.tar.gz |
eventlog: Dump cost centre stack on each sample
With this change it is possible to reconstruct the timing portion of a
`.prof` file after the fact. By logging the stacks at each time point
a more precise executation trace of the program can be observed rather
than all identical cost centres being identified in the report.
There are two new events:
1. `EVENT_PROF_BEGIN` - emitted at the start of profiling to communicate
the tick interval
2. `EVENT_PROF_SAMPLE_COST_CENTRE` - emitted on each tick to communicate the
current call stack.
Fixes #17322
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/8.10.1-notes.rst | 3 | ||||
-rw-r--r-- | docs/users_guide/eventlog-formats.rst | 30 |
2 files changed, 33 insertions, 0 deletions
diff --git a/docs/users_guide/8.10.1-notes.rst b/docs/users_guide/8.10.1-notes.rst index 64c2da2e09..54046d06bb 100644 --- a/docs/users_guide/8.10.1-notes.rst +++ b/docs/users_guide/8.10.1-notes.rst @@ -166,6 +166,9 @@ Compiler the sample start event contains a timestamp of when the census occurred. The retainer profiling events are emitted using the standard events. +- The eventlog now logs the cost centre stack on each sample. This enables + the `.prof` file to be partially reconstructed from the eventlog. + - Add new flag :ghc-flag:`-fkeep-going` which makes the compiler continue as far as it can despite errors. diff --git a/docs/users_guide/eventlog-formats.rst b/docs/users_guide/eventlog-formats.rst index 27bd37cd3f..a3ed47fc3c 100644 --- a/docs/users_guide/eventlog-formats.rst +++ b/docs/users_guide/eventlog-formats.rst @@ -134,3 +134,33 @@ A variable-length event encoding a heap sample broken down by, * ``Word8``: Profile ID * ``Word64``: heap residency in bytes * ``String``: type or closure description, or module name + +.. _time-profiler-events: + +Time profiler event log output +------------------------------ + +The time profiling mode enabled by ``-p`` also emits sample events to the eventlog. +At the start of profiling the tick interval is emitted to the eventlog and then +on each tick the current cost centre stack is emitted. Together these enable +a user to construct an approximate track of the executation of their program. + +Profile begin event +^^^^^^^^^^^^^^^^^^^ + + * ``EVENT_PROF_BEGIN`` + + * ``Word64``: Tick interval, in nanoseconds + + +Tick sample event +^^^^^^^^^^^^^^^^^^ + +A variable-length packet encoding a profile sample. + +* ``EVENT_PROF_SAMPLE_COST_CENTRE`` + + * ``Word32``: Capability + * ``Word64``: Current profiling tick + * ``Word8``: stack depth + * ``Word32[]``: cost centre stack starting with inner-most (cost centre numbers) |