Commit bcf422a9 authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Remove old runner summary

parent 84985eb7
#!/usr/bin/env python3
from collections import defaultdict
import re
import sys
import ggplot as gg
import pandas
import yaml
def record_from_log(log):
log_path = log
with open(log) as log:
# filter out garbage in log
log = re.findall(r'\w+:.*', log.read())
log = '\n'.join(log)
return yaml.load(log)
if __name__ == '__main__':
routers = set()
traces = defaultdict(list)
for log in sys.argv[1:]:
record = record_from_log(log)
record['trace'] = re.sub(r'.*(shed\d).*', '\\1', record['trace'])
if record['community'] != 'none':
record['router'] += '_' + record['community']
routers.add(record['router'])
del record['community']
traces[record['trace']].append(record)
traces = {
trace: pandas.DataFrame.from_records(records)
for trace, records in traces.items()
}
def get_router(trace, router):
trace = traces[trace]
return trace[trace['router'] == router]
summary = []
for trace in traces:
for router in routers:
df = get_router(trace, router).mean()
df['trace'] = trace
df['router'] = router
summary.append(df)
summary = pandas.DataFrame.from_records(summary)
for router in routers:
aes = gg.aes(
x='trace',
y='delivery_ratio',
weight='delivery_ratio',
)
plt = gg.ggplot(aes, summary[summary['router']==router])
plt += gg.geom_bar()
plt += gg.ggtitle(f'{router}')
plt += gg.ylim(low=0, high=1)
plt.save(f'{router}.png', width=8, height=6, dpi=300)
Supports Markdown
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