[LNT] r239031 - analysis: Flip min() to max() for aggregation if bigger_is_better.
James Molloy
james.molloy at arm.com
Thu Jun 4 02:30:39 PDT 2015
Author: jamesm
Date: Thu Jun 4 04:30:38 2015
New Revision: 239031
URL: http://llvm.org/viewvc/llvm-project?rev=239031&view=rev
Log:
analysis: Flip min() to max() for aggregation if bigger_is_better.
As the sense of the benchmark is flipped, it makes sense to flip the
aggregation function too.
Modified:
lnt/trunk/lnt/server/reporting/analysis.py
lnt/trunk/lnt/util/stats.py
Modified: lnt/trunk/lnt/server/reporting/analysis.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/analysis.py?rev=239031&r1=239030&r2=239031&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/analysis.py (original)
+++ lnt/trunk/lnt/server/reporting/analysis.py Thu Jun 4 04:30:38 2015
@@ -52,6 +52,12 @@ class ComparisonResult:
cur_failed, prev_failed, samples, prev_samples,
confidence_lv=0.05, bigger_is_better=False):
self.aggregation_fn = aggregation_fn
+
+ # Special case: if we're using the minimum to aggregate, swap it for max
+ # if bigger_is_better.
+ if aggregation_fn == stats.safe_min:
+ aggregation_fn = stats.safe_max
+
if samples:
self.current = aggregation_fn(samples)
else:
Modified: lnt/trunk/lnt/util/stats.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/stats.py?rev=239031&r1=239030&r2=239031&view=diff
==============================================================================
--- lnt/trunk/lnt/util/stats.py (original)
+++ lnt/trunk/lnt/util/stats.py Thu Jun 4 04:30:38 2015
@@ -10,6 +10,13 @@ def safe_min(l):
else:
return min(l)
+def safe_max(l):
+ """Calculate max, but if given an empty list return None."""
+ l = list(l) #In case this is a complex type, get a simple list.
+ if not l:
+ return None
+ else:
+ return max(l)
def check_floating(l):
"""These math ops are totally wrong when they done on anything besides
More information about the llvm-commits
mailing list