Commit 68497d00 authored by Ben Gamari's avatar Ben Gamari 🐢

ghc_timings: Simple plotting

parent 7ae9ceaf
......@@ -5,6 +5,7 @@ import re
import sys
import typing
import pandas as pd
from matplotlib import pyplot as pl
from typing import Iterator
class Timing(typing.NamedTuple):
......@@ -26,11 +27,16 @@ def parse_timings(s: str) -> pd.DataFrame:
df = pd.DataFrame(xs, columns=['phase', 'module', 'time', 'allocd'])
df['n'] = df.index
df.sort_values(by=['module', 'n'], inplace=True)
return df.drop(columns='n')
return df # df.drop(columns='n')
def main() -> None:
s = sys.stdin.read()
print(parse_timings(s).to_markdown())
df = parse_timings(s)
print(df.to_markdown())
df2 = df.set_index(['module', 'phase', 'n'])['time'].unstack('module')
df2.plot.bar(title='compile time (ms)', rot=30)
pl.show()
if __name__ == '__main__':
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