[LNT] r213127 - Show geomean for filtered tests

Yi Kong Yi.Kong at arm.com
Wed Jul 16 01:50:20 PDT 2014


Author: kongyi
Date: Wed Jul 16 03:50:16 2014
New Revision: 213127

URL: http://llvm.org/viewvc/llvm-project?rev=213127&view=rev
Log:
Show geomean for filtered tests

LNT shows geomean for all tests, even if user filters a subset of tests.

This patch lets LNT to calculate geomean for the chosen tests only.
Also it stores the comparison results to avoid computing aggregation
function twice.

Modified:
    lnt/trunk/lnt/server/reporting/analysis.py
    lnt/trunk/lnt/server/ui/templates/v4_run.html

Modified: lnt/trunk/lnt/server/reporting/analysis.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/analysis.py?rev=213127&r1=213126&r2=213127&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/analysis.py (original)
+++ lnt/trunk/lnt/server/reporting/analysis.py Wed Jul 16 03:50:16 2014
@@ -239,19 +239,6 @@ class RunInfo(object):
                                 run_failed, prev_failed, run_values,
                                 prev_values, stddev_mean, self.confidence_lv)
 
-    def _extract_values_from_samples(self, run, field):
-        """Given a run object, collect values for a particular field."""
-
-        run_samples = filter(lambda x: x is not None,
-                             [self.sample_map.get((run, test_id))
-                              for test_id in self.get_test_ids()])
-
-        run_values = filter(lambda x: x is not None,
-                            [self.aggregation_fn(a[field]
-                             for a in e if a[field] is not None)
-                             for e in run_samples if e])
-        return run_values
-
     def _calc_geomean(self, run_values):
         # NOTE Geometric mean applied only to positive values, so fix it by
         # adding MIN_VALUE to each value and substract it from the result.
@@ -268,15 +255,11 @@ class RunInfo(object):
 
         return util.geometric_mean(values) - MIN_VALUE
 
-    def get_geomean_comparison_result(self, run, compare_to, field,
+    def get_geomean_comparison_result(self, run, compare_to, field, tests,
                                       comparison_window=[]):
-        run_values = self._extract_values_from_samples(run.id, field.index)
-        run_geomean = self._calc_geomean(run_values)
+        prev_values,run_values = zip(*[(cr.previous,cr.current) for _,_,cr in tests])
 
-        if compare_to:
-            prev_values = self._extract_values_from_samples(compare_to.id, field.index)
-        else:
-            prev_values = []
+        run_geomean = self._calc_geomean(run_values)
         prev_geomean = self._calc_geomean(prev_values)
 
         if run_geomean and prev_geomean:

Modified: lnt/trunk/lnt/server/ui/templates/v4_run.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_run.html?rev=213127&r1=213126&r2=213127&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_run.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_run.html Wed Jul 16 03:50:16 2014
@@ -311,23 +311,28 @@
           </tr>
         </thead>
         <tbody>  
-		  {% set (runs, compare_runs) = request_info.sri.get_sliding_runs(run, compare_to, request_info.num_comparison_runs) %}
+          {% set tests = [] %}
+          {% set (runs, compare_runs) = request_info.sri.get_sliding_runs(run, compare_to, request_info.num_comparison_runs) %}
           {% for test_name,test_id in test_info %}
-		    {% set cr = request_info.sri.get_comparison_result(runs, compare_runs, test_id, field) %}
+            {% set cr = request_info.sri.get_comparison_result(runs, compare_runs, test_id, field) %}
             {% if cr.previous is not none or cr.current is not none %}
               {% if cr.current is none or cr.current >= test_min_value_filter %}
-                <tr>
-                  <td><input type="checkbox" name="plot.{{test_id}}" value="{{machine.id}}.{{test_id}}.{{field.index}}"></td>
-                  <td><a href="{{graph_base}}&plot.{{test_id}}={{ machine.id}}.{{test_id}}.{{field.index}}">{{ test_name }}</a></td>
-                  {{ get_cell_value(cr) }}
-                </tr>
+                {% if tests.append((test_name, test_id, cr)) %}{% endif %}
               {% endif %}
             {% endif %}
           {% endfor %}
+
+          {% for test_name,test_id,cr in tests %}
+            <tr>
+              <td><input type="checkbox" name="plot.{{test_id}}" value="{{machine.id}}.{{test_id}}.{{field.index}}"></td>
+              <td><a href="{{graph_base}}&plot.{{test_id}}={{ machine.id}}.{{test_id}}.{{field.index}}">{{ test_name }}</a></td>
+              {{ get_cell_value(cr) }}
+            </tr>
+          {% endfor %}
         </tbody>
         <tfoot>
           {% set cr = request_info.sri.get_geomean_comparison_result(
-                      run, compare_to, field, request_info.comparison_window) %}
+                      run, compare_to, field, tests, request_info.comparison_window) %}
           <td></td>
           <td>Mean</td>
           {{ get_cell_value(cr) }}





More information about the llvm-commits mailing list