[llvm-commits] [zorg] r150113 - in /zorg/trunk/lnt/lnt/server/ui: templates/v4_run.html templates/v4_utils.html views.py

Daniel Dunbar daniel at zuster.org
Wed Feb 8 15:33:40 PST 2012


Author: ddunbar
Date: Wed Feb  8 17:33:40 2012
New Revision: 150113

URL: http://llvm.org/viewvc/llvm-project?rev=150113&view=rev
Log:
[lnt/v0.4] lnt.server.ui: Add trivial UI for selecting a different run to compare to.

Modified:
    zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html
    zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html
    zorg/trunk/lnt/lnt/server/ui/views.py

Modified: zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html?rev=150113&r1=150112&r2=150113&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html Wed Feb  8 17:33:40 2012
@@ -72,7 +72,8 @@
 
 {% endmacro %}
 
-{% call v4_utils.v4_run_page(ts, machine, run, compare_to, neighboring_runs) %}
+{% call v4_utils.v4_run_page(ts, machine, run, compare_to, neighboring_runs,
+                             comparison_neighboring_runs) %}
 
 {{ utils.render_popup_begin('view_options', 'View Options', true) }}
 <form action="" method="get">
@@ -124,6 +125,10 @@
 <input type="text" name="test_filter" value="{{
        options.test_filter }}"><br>
 
+{% if compare_to %}
+<input type="hidden" name="compare_to" value="{{compare_to.id}}">
+{% endif %}
+
 <input type="submit" name="submit" value="Update">
 </form>
 

Modified: zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html?rev=150113&r1=150112&r2=150113&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html Wed Feb  8 17:33:40 2012
@@ -1,6 +1,7 @@
 {% import "utils.html" as utils %}
 
-{% macro v4_run_page(ts, machine, run, compare_to, neighboring_runs) %}
+{% macro v4_run_page(ts, machine, run, compare_to, neighboring_runs,
+                     comparison_neighboring_runs=none) %}
 
 <center>
   <table>
@@ -43,6 +44,19 @@
             "</h3>"|safe if r.id == run.id }}
 {% endfor %}
       </ul>
+
+{# Show a small number of runs in the neighborhood of the comparison run. #}
+{% if comparison_neighboring_runs %}
+      <h4>Compare To:</h4>
+      <ul>
+{% for r in comparison_neighboring_runs %}
+        <li>{{ "<h3>"|safe if r.id == compare_to.id }}
+            <a href="{{v4_url_for('v4_run', id=run.id, compare_to=r.id)}}">{{
+                     r.start_time}}</a>{{
+            "</h3>"|safe if r.id == compare_to.id }}
+{% endfor %}
+      </ul>
+{% endif %}
     </td>
     <td valign="top">
       <table border=1>

Modified: zorg/trunk/lnt/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/views.py?rev=150113&r1=150112&r2=150113&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Wed Feb  8 17:33:40 2012
@@ -790,12 +790,29 @@
     # 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))
-    if prev_runs:
-        compare_to = prev_runs[0]
-    else:
-        compare_to = None
     neighboring_runs = next_runs[::-1] + [run] + prev_runs
 
+    # Select the comparison run as either the previous run, or a user specified
+    # comparison run.
+    compare_to_str = request.args.get('compare_to')
+    if compare_to_str:
+        compare_to_id = int(compare_to_str)
+        compare_to = ts.query(ts.Run).filter_by(id = compare_to_id).first()
+        if compare_to is None:
+            return render_template("error.html", message="""\
+Invalid compare_to ID %r""" % compare_to_str)
+
+        comparison_neighboring_runs = (
+            list(ts.get_next_runs_on_machine(compare_to, N=3))[::-1] +
+            [compare_to] +
+            list(ts.get_previous_runs_on_machine(compare_to, N=3)))
+    else:
+        if prev_runs:
+            compare_to = prev_runs[0]
+        else:
+            compare_to = None
+        comparison_neighboring_runs = neighboring_runs
+
     # Parse the view options.
     options = {}
     options['show_delta'] = bool(request.args.get('show_delta'))
@@ -851,6 +868,7 @@
     return render_template(
         "v4_run.html", ts=ts, run=run, compare_to=compare_to,
         options=options, neighboring_runs=neighboring_runs,
+        comparison_neighboring_runs=comparison_neighboring_runs,
         text_report=text_report, html_report=html_report,
         primary_fields=list(ts.Sample.get_primary_fields()),
         comparison_window=comparison_window,





More information about the llvm-commits mailing list