diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-08-07 20:42:02 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-08-07 20:42:02 +0300 |
commit | 9f3312a79f0782ef666f278de8cf36715658505f (patch) | |
tree | ce4ec99364e465b4c257cbfa8eeb619e8c866cdd | |
parent | 39a7e7bfa775cd7bd90abcc5b0a91519ec338b63 (diff) | |
download | obnam-benchmarks-9f3312a79f0782ef666f278de8cf36715658505f.tar.gz |
Display references in summary table
-rwxr-xr-x | obbench | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -288,7 +288,7 @@ class ObnamBenchmarker(cliapp.Application): f.write('<th>commit</th>\n') f.write('<th>commit msg</th>\n') for name in benchmark_names: - f.write('<th>{name}</th>\n'.format(name=self.q(name))) + f.write('<th>{name} (ref)</th>\n'.format(name=self.q(name))) f.write('</tr>\n') for run in runs: @@ -307,11 +307,14 @@ class ObnamBenchmarker(cliapp.Application): commit=self.q(run['commit_id']), name=self.q(name)) duration = '%.1f' % run['durations'][name] + reference = '%.0f' % run['references'][name] f.write( '<td class="duration">' - '<a href="{link}">{duration}</a></td>\n'.format( + '<a href="{link}">{duration}</a> ' + '({reference})</td>\n'.format( link=link, - duration=self.q(duration))) + duration=self.q(duration), + reference=reference)) f.write('</tr>\n') f.write('</table>\n') @@ -334,8 +337,8 @@ class ObnamBenchmarker(cliapp.Application): def make_key(obj): return (obj['date'], obj['commit_id']) - def total(obj): - return sum(step['duration'] for step in obj['steps']) + def total(obj, field): + return sum(step[field] for step in obj['steps']) sorted_objs = [] for obj in objs: @@ -349,10 +352,12 @@ class ObnamBenchmarker(cliapp.Application): 'date': obj['date'], 'commit_id': obj['commit_id'], 'commit_msg': obj['commit_msg'], - 'durations': { obj['name']: total(obj) } + 'durations': { obj['name']: total(obj, 'duration') }, + 'references': { obj['name']: total(obj, 'reference') }, }) else: - runs[-1]['durations'][obj['name']] = total(obj) + runs[-1]['durations'][obj['name']] = total(obj, 'duration') + runs[-1]['references'][obj['name']] = total(obj, 'reference') return runs |