Skip to content

Commit

Permalink
Add another reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Bechberger committed Jan 8, 2020
1 parent d22c6a8 commit 2c6a150
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions temci/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1960,3 +1960,35 @@ def _report_prop(self, run: RunData, prop: str) -> dict:
"min": min(run[prop]),
"max": max(run[prop]),
}


@register(ReporterRegistry, "codespeed2", Dict({}))
class Codespeed2Reporter(AbstractReporter):
"""
Reporter that outputs JSON as specified by
the `codespeed runner spec <https://git.scc.kit.edu/IPDSnelting/codespeed-runner>`_.
"""

def report(self):
"""
Create a report and output it as configured.
"""
import json
res = {}
for run in self.stats_helper.errorneous_runs:
bench_res = {}
for prop in run.properties:
bench_res[prop] = {
"error": run.recorded_error.message
}
res[run.description()] = bench_res
for run in self.stats_helper.runs:
bench_res = {}
for prop in run.properties:
bench_res[prop] = {
"results": run[prop],
"unit": ("s" if "time" in prop or "clock" in prop else prop),
"resultInterpretation": "LESS_IS_BETTER"
}
res[run.description()] = bench_res
json.dump(res, sys.stdout)

0 comments on commit 2c6a150

Please sign in to comment.