diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-09-12 23:52:43 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-15 15:21:06 -0400 |
commit | b3143f5a0827b640840ef241a30933dc23b69d91 (patch) | |
tree | b95839ec757a0dd3406b4bad0431bd651564260c /testsuite/driver | |
parent | 0f3884b0b72fb1e4641450e68f63580c0e86f515 (diff) | |
download | haskell-b3143f5a0827b640840ef241a30933dc23b69d91.tar.gz |
Enhance metrics output
Diffstat (limited to 'testsuite/driver')
-rw-r--r-- | testsuite/driver/perf_notes.py | 10 | ||||
-rw-r--r-- | testsuite/driver/runtests.py | 11 |
2 files changed, 11 insertions, 10 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 28038e630c..390d21a124 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -108,12 +108,12 @@ class MetricChange(Enum): } return strings[self] - def short_name(self): + def hint(self): strings = { - MetricChange.NewMetric: "new", - MetricChange.NoChange: "unch", - MetricChange.Increase: "incr", - MetricChange.Decrease: "decr" + MetricChange.NewMetric: colored(Color.BLUE,"NEW"), + MetricChange.NoChange: "", + MetricChange.Increase: colored(Color.RED, "BAD"), + MetricChange.Decrease: colored(Color.GREEN,"GOOD") } return strings[self] diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index d9a0bf6b59..c4411977dd 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -348,21 +348,21 @@ def tabulate_metrics(metrics: List[PerfMetric]) -> None: hideBaselineEnv = not hasBaseline or all( [x.stat.test_env == x.baseline.perfStat.test_env for x in metrics if x.baseline is not None]) - def row(cells: Tuple[str, str, str, str, str, str, str]) -> List[str]: + def row(cells: Tuple[str, str, str, str, str, str, str, str]) -> List[str]: return [x for (idx, x) in enumerate(list(cells)) if (idx != 2 or not hideBaselineCommit) and (idx != 3 or not hideBaselineEnv )] headerRows = [ - row(("", "", "Baseline", "Baseline", "Baseline", "", "")), - row(("Test", "Metric", "commit", "environment", "value", "New value", "Change")) + row(("", "", "Baseline", "Baseline", "Baseline", "", "", "")), + row(("Test", "Metric", "commit", "environment", "value", "New value", "Change", "")) ] def strDiff(x: PerfMetric) -> str: if x.baseline is None: return "" val0 = x.baseline.perfStat.value val1 = x.stat.value - return "{}({:+2.1f}%)".format(x.change.short_name(), 100 * (val1 - val0) / val0) + return "{:+2.1f}%".format(100 * (val1 - val0) / val0) dataRows = [row(( "{}({})".format(x.stat.test, x.stat.way), shorten_metric_name(x.stat.metric), @@ -374,7 +374,8 @@ def tabulate_metrics(metrics: List[PerfMetric]) -> None: "{:13.1f}".format(x.baseline.perfStat.value) if x.baseline is not None else "", "{:13.1f}".format(x.stat.value), - strDiff(x) + strDiff(x), + "{}".format(x.change.hint()) )) for x in sorted(metrics, key = lambda m: (m.stat.test, m.stat.way, m.stat.metric))] print_table(headerRows, dataRows, 1) |