[Git][ghc/ghc][master] Enhance metrics output

Marge Bot gitlab at gitlab.haskell.org
Tue Sep 15 19:21:13 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
b3143f5a by Sylvain Henry at 2020-09-15T15:21:06-04:00
Enhance metrics output

- - - - -


2 changed files:

- testsuite/driver/perf_notes.py
- testsuite/driver/runtests.py


Changes:

=====================================
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]
 


=====================================
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)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3143f5a0827b640840ef241a30933dc23b69d91

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3143f5a0827b640840ef241a30933dc23b69d91
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200915/e6fa2f24/attachment-0001.html>


More information about the ghc-commits mailing list