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

Merge branch 'master' of gitlab.haskell.org:bgamari/ghc-utils into master

parents c8e11dc8 15115a15
......@@ -57,6 +57,7 @@ def main() -> None:
print('--quantile must be less than 0.5')
sys.exit(1)
tables = []
if args.list:
print('\n'.join(sorted(all_metrics)))
else:
......@@ -86,7 +87,10 @@ def main() -> None:
max_bound = xs['value'].quantile(1-q)
print(f'\n### `{metric}`')
print(xs[(xs['value'] > min_bound) & (xs['value'] < max_bound)].groupby('file').aggregate(['mean', 'std', 'count'])['value'].to_markdown())
table = xs[(xs['value'] >= min_bound) & (xs['value'] <= max_bound)].groupby('file').aggregate(['mean', 'std', 'count'])
tables += [table.rename(columns={'value': metric})]
print(table['value'].to_markdown())
bounds = (min_bound, max_bound)
for name, values in xs.groupby('file'):
pl.hist(values['value'], label=name, bins=args.bins, range=bounds, alpha=0.6)
......@@ -97,5 +101,13 @@ def main() -> None:
out = metric.replace('//', '-').replace('/', '_')
pl.savefig(f'{out}.svg')
print('\n### Summary')
summary = pd.concat(tables, axis='columns')
if (summary.loc[:, (slice(None),'count')] == 1).all(axis=None):
# If there is only sample of each then drop the std and count columns
summary = summary.loc[:, (slice(None), 'mean')].droplevel(level=1, axis='columns')
print(summary.to_markdown())
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