[llvm-commits] [LNT] r156015 - in /lnt/trunk/lnt/server: reporting/analysis.py reporting/runs.py ui/templates/v4_run.html ui/views.py
Daniel Dunbar
daniel at zuster.org
Wed May 2 13:13:54 PDT 2012
Author: ddunbar
Date: Wed May 2 15:13:54 2012
New Revision: 156015
URL: http://llvm.org/viewvc/llvm-project?rev=156015&view=rev
Log:
UI/v4 runs: Add support for using median instead of min to aggregate values.
Modified:
lnt/trunk/lnt/server/reporting/analysis.py
lnt/trunk/lnt/server/reporting/runs.py
lnt/trunk/lnt/server/ui/templates/v4_run.html
lnt/trunk/lnt/server/ui/views.py
Modified: lnt/trunk/lnt/server/reporting/analysis.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/analysis.py?rev=156015&r1=156014&r2=156015&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/analysis.py (original)
+++ lnt/trunk/lnt/server/reporting/analysis.py Wed May 2 15:13:54 2012
@@ -8,8 +8,10 @@
from lnt.testing import PASS, FAIL, XFAIL
class RunInfo(object):
- def __init__(self, testsuite, runs_to_load):
+ def __init__(self, testsuite, runs_to_load,
+ aggregation_fn = min):
self.testsuite = testsuite
+ self.aggregation_fn = aggregation_fn
self.sample_map = util.multidict()
self.loaded_run_ids = set()
@@ -50,11 +52,11 @@
prev_values = [s[field.index] for s in prev_samples
if s[field.index] is not None]
if run_values:
- run_value = min(run_values)
+ run_value = self.aggregation_fn(run_values)
else:
run_value = None
if prev_values:
- prev_value = min(prev_values)
+ prev_value = self.aggregation_fn(prev_values)
else:
prev_value = None
Modified: lnt/trunk/lnt/server/reporting/runs.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/runs.py?rev=156015&r1=156014&r2=156015&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/runs.py (original)
+++ lnt/trunk/lnt/server/reporting/runs.py Wed May 2 15:13:54 2012
@@ -9,12 +9,13 @@
import lnt.server.reporting.analysis
import lnt.server.ui.util
+import lnt.util.stats
from lnt.db import runinfo
def generate_run_report(run, baseurl, only_html_body = False,
num_comparison_runs = 10, result = None,
compare_to = None, baseline = None,
- comparison_window = None):
+ comparison_window = None, aggregation_fn = min):
"""
generate_run_report(...) -> (str: subject, str: text_report,
str: html_report)
@@ -82,7 +83,8 @@
runs_to_load.add(compare_to.id)
if baseline:
runs_to_load.add(baseline.id)
- sri = lnt.server.reporting.analysis.RunInfo(ts, runs_to_load)
+ sri = lnt.server.reporting.analysis.RunInfo(
+ ts, runs_to_load, aggregation_fn)
# Get the test names, primary fields and total test counts.
test_names = ts.query(ts.Test.name, ts.Test.id).order_by(ts.Test.name).all()
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=156015&r1=156014&r2=156015&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_run.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_run.html Wed May 2 15:13:54 2012
@@ -134,6 +134,16 @@
<input type="text" name="test_min_value_filter" value="{{
options.test_min_value_filter }}"><br>
+<b>Aggregation Function</b>
+<select name="aggregation_fn">
+<option value="min" {{ " selected"
+ if "min" == options.aggregation_fn else ""}}>
+ Minimum</value>
+<option value="median" {{ " selected"
+ if "median" == options.aggregation_fn else ""}}>
+ Median</value>
+</select>
+
{% if compare_to %}
<input type="hidden" name="compare_to" value="{{compare_to.id}}">
{% endif %}
Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=156015&r1=156014&r2=156015&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Wed May 2 15:13:54 2012
@@ -16,6 +16,7 @@
import lnt.util
import lnt.util.ImportData
+import lnt.util.stats
from lnt.db import perfdb
from lnt.server.ui.globals import db_url_for, v4_url_for
import lnt.server.reporting.analysis
@@ -693,6 +694,12 @@
if run is None:
abort(404)
+ # Get the aggregation function to use.
+ aggregation_fn_name = request.args.get('aggregation_fn')
+ self.aggregation_fn = { 'min' : min,
+ 'median' : lnt.util.stats.median }.get(
+ aggregation_fn_name, min)
+
# Find the neighboring runs, by order.
prev_runs = list(ts.get_previous_runs_on_machine(run, N = 3))
next_runs = list(ts.get_next_runs_on_machine(run, N = 3))
@@ -747,7 +754,8 @@
self.run, baseurl=db_url_for('index', _external=True),
only_html_body=only_html_body, result=None,
compare_to=self.compare_to, baseline=self.baseline,
- comparison_window=self.comparison_window)
+ comparison_window=self.comparison_window,
+ aggregation_fn=self.aggregation_fn)
_, self.text_report, self.html_report, self.sri = reports
@v4_route("/<int:id>/report")
@@ -798,6 +806,8 @@
else:
test_min_value_filter = 0.0
+ options['aggregation_fn'] = request.args.get('aggregation_fn', 'min')
+
# Get the test names.
test_info = ts.query(ts.Test.name, ts.Test.id).\
order_by(ts.Test.name).all()
More information about the llvm-commits
mailing list