Commit f9207038 authored by Ben Gamari's avatar Ben Gamari 🐢

ghc_timings: Introduce it

parent e1b75039
......@@ -43,6 +43,7 @@ the scripts are available using `nix-shell`.
* `eventlog-sort`: A hack to dump the events from a GHC eventlog with relative
timestamps (in milliseconds).
* ``: A small hack to turn `-ddump-timings` output into a Markdown table.
## Release engineering
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
import typing
from typing import Iterator
class Timing(typing.NamedTuple):
phase: str
module: str
time: float
allocd: float
def parse_timings(s: str) -> Iterator[Timing]:
for m in re.finditer(r'!!! ([\w \d]+) \[([\w\d_\.]+)\]: finished in (\d+\.\d+) milliseconds, allocated (\d+\.\d+) megabytes', s):
phase =
module =
time = float(
allocd = float(
yield Timing(phase, module, time, allocd)
def main() -> None:
s =
print('| module | phase | time (ms) | alloc (MB) |')
print('| ------ | ----- | --------- | ---------- |')
for t in parse_timings(s):
print('| {module} | {phase} | {time} | {allocd} |'.format(**t))
if __name__ == '__main__':
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment