[LNT] r263924 - [profile] Add profile IDs to ComparisonResult
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 03:45:56 PDT 2016
Author: jamesm
Date: Mon Mar 21 05:45:55 2016
New Revision: 263924
URL: http://llvm.org/viewvc/llvm-project?rev=263924&view=rev
Log:
[profile] Add profile IDs to ComparisonResult
And use these to render links to profiles in the run table.
Modified:
lnt/trunk/lnt/server/reporting/analysis.py
lnt/trunk/lnt/server/ui/globals.py
lnt/trunk/lnt/server/ui/templates/layout.html
lnt/trunk/lnt/server/ui/templates/utils.html
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=263924&r1=263923&r2=263924&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/analysis.py (original)
+++ lnt/trunk/lnt/server/reporting/analysis.py Mon Mar 21 05:45:55 2016
@@ -60,7 +60,7 @@ class ComparisonResult:
def __init__(self, aggregation_fn,
cur_failed, prev_failed, samples, prev_samples,
- cur_hash, prev_hash,
+ cur_hash, prev_hash, cur_profile=None, prev_profile=None,
confidence_lv=0.05, bigger_is_better=False):
self.aggregation_fn = aggregation_fn
@@ -71,6 +71,8 @@ class ComparisonResult:
self.cur_hash = cur_hash
self.prev_hash = prev_hash
+ self.cur_profile = cur_profile
+ self.prev_profile = prev_profile
if samples:
self.current = aggregation_fn(samples)
@@ -256,6 +258,7 @@ class RunInfo(object):
self.confidence_lv = confidence_lv
self.sample_map = util.multidict()
+ self.profile_map = dict()
self.loaded_run_ids = set()
self._load_samples_for_runs(runs_to_load, only_tests)
@@ -309,6 +312,12 @@ class RunInfo(object):
run_samples = self.get_samples(runs, test_id)
prev_samples = self.get_samples(compare_runs, test_id)
+ cur_profile = prev_profile = None
+ if runs:
+ cur_profile = self.profile_map.get((runs[0].id, test_id), None)
+ if compare_runs:
+ prev_profile = self.profile_map.get((compare_runs[0].id, test_id), None)
+
# Determine whether this (test,pset) passed or failed in the current and
# previous runs.
#
@@ -354,6 +363,7 @@ class RunInfo(object):
r = ComparisonResult(self.aggregation_fn,
run_failed, prev_failed, run_values,
prev_values, cur_hash, prev_hash,
+ cur_profile, prev_profile,
self.confidence_lv,
bigger_is_better=field.bigger_is_better)
return r
@@ -397,7 +407,8 @@ class RunInfo(object):
# We speed things up considerably by loading the column data directly
# here instead of requiring SA to materialize Sample objects.
columns = [self.testsuite.Sample.run_id,
- self.testsuite.Sample.test_id]
+ self.testsuite.Sample.test_id,
+ self.testsuite.Sample.profile_id]
columns.extend(f.column for f in self.testsuite.sample_fields)
q = self.testsuite.query(*columns)
if only_tests:
@@ -406,7 +417,10 @@ class RunInfo(object):
for data in q:
run_id = data[0]
test_id = data[1]
- sample_values = data[2:]
+ profile_id = data[2]
+ sample_values = data[3:]
self.sample_map[(run_id, test_id)] = sample_values
+ if profile_id is not None:
+ self.profile_map[(run_id, test_id)] = profile_id
self.loaded_run_ids |= to_load
Modified: lnt/trunk/lnt/server/ui/globals.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/globals.py?rev=263924&r1=263923&r2=263924&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/globals.py (original)
+++ lnt/trunk/lnt/server/ui/globals.py Mon Mar 21 05:45:55 2016
@@ -18,6 +18,17 @@ def v4_url_for(*args, **kwargs):
return flask.url_for(*args, db_name=flask.g.db_name,
testsuite_name=flask.g.testsuite_name, **kwargs)
+def v4_url_available(*args, **kwargs):
+ """
+ Return True if v4_url_for can be used; if there is a testsuite_name
+ in the global context.
+ """
+ try:
+ flask.g.testsuite_name
+ return True
+ except:
+ return False
+
def register(env):
# Add some normal Python builtins which can be useful in templates.
env.globals.update(zip=zip)
@@ -25,4 +36,5 @@ def register(env):
# Add our custom global functions.
env.globals.update(
db_url_for=db_url_for,
- v4_url_for=v4_url_for)
+ v4_url_for=v4_url_for,
+ v4_url_available=v4_url_available)
Modified: lnt/trunk/lnt/server/ui/templates/layout.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/layout.html?rev=263924&r1=263923&r2=263924&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/layout.html (original)
+++ lnt/trunk/lnt/server/ui/templates/layout.html Mon Mar 21 05:45:55 2016
@@ -75,6 +75,16 @@
}
}
+ /* Make profile buttons invisible by default */
+ tr .profile-btn {
+ visibility: hidden;
+ }
+
+ /* But appear when their parent table rows are hovered. */
+ tr:hover .profile-btn {
+ visibility: visible;
+ }
+
</style>
<link rel="icon" type="image/png" href="{{ url_for('.static', filename='favicon.ico') }}"/>
Modified: lnt/trunk/lnt/server/ui/templates/utils.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/utils.html?rev=263924&r1=263923&r2=263924&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/utils.html (original)
+++ lnt/trunk/lnt/server/ui/templates/utils.html Mon Mar 21 05:45:55 2016
@@ -30,6 +30,28 @@
<a href="{{bug}}">{{bug}}</a>
{%- endmacro %}
+{% macro render_profile_link(profile, compare_profile, run_id, compare_run_id, test_id) -%}
+ {% if v4_url_available() %}
+ {% if compare_profile and profile %}
+
+ <a href="{{ v4_url_for('v4_profile_fwd2', run1_id=run_id, run2_id=compare_run_id, testid=test_id) }}"
+ class="profile-btn btn btn-mini pull-right">Profile<i class="icon-eye-open"></i></a>
+
+ {% elif profile %}
+
+ <a href="{{ v4_url_for('v4_profile_fwd', run1_id=run_id, testid=test_id) }}"
+ class="profile-btn btn btn-mni pull-right profile-but-no-prev" data-toggle="tooltip"
+ title="This run has a profile, but the run being compared to does not">Profile<i class="icon-exclamation-sign"></i></a>
+
+ {% elif compare_profile %}
+
+ <a href="{{ v4_url_for('v4_profile_fwd', run1_id=compare_run_id, testid=test_id) }}"
+ class="profile-btn bt btn-mini pull-right profile-prev-only" data-toggle="tooltip"
+ title="This run does not have a profile, but the run being compared to does">Profile<i class="icon-exclamation-sign"></i></a>
+
+ {% endif %}
+ {% endif %}
+{%- endmacro %}
{% macro regex_filter_box(input_id, selector, placeholder,
selector_part_to_search=None) -%}
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=263924&r1=263923&r2=263924&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_run.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_run.html Mon Mar 21 05:45:55 2016
@@ -24,6 +24,11 @@
</script>
{% endblock %}
+{% block onload %}
+$('.profile-but-no-prev').tooltip();
+$('.profile-prev-only').tooltip();
+{% endblock %}
+
{% block title %}Run Results{% endblock %}
{% macro get_cell_value(cr) %}
@@ -341,7 +346,12 @@
{% 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 class="benchmark-name"><a href="{{graph_base}}&plot.{{test_id}}={{ machine.id}}.{{test_id}}.{{field.index}}">{{ test_name }}</a></td>
+ <td class="benchmark-name">
+ <a href="{{graph_base}}&plot.{{test_id}}={{ machine.id}}.{{test_id}}.{{field.index}}">
+ {{ test_name }}
+ </a>
+ {{ utils.render_profile_link(cr.profile, cr.prev_profile, run.id, compare_to.id, test_id) }}
+ </td>
{{ get_cell_value(cr) }}
</tr>
{% endfor %}
More information about the llvm-commits
mailing list