[llvm-commits] [zorg] r130219 - in /zorg/trunk/lnt/lnt: db/perfdbsummary.py server/ui/filters.py server/ui/static/View2D.js server/ui/static/sorttable.js server/ui/templates/simple_run.html server/ui/templates/simple_utils.html server/ui/views.py

Daniel Dunbar daniel at zuster.org
Tue Apr 26 10:48:21 PDT 2011


Author: ddunbar
Date: Tue Apr 26 12:48:21 2011
New Revision: 130219

URL: http://llvm.org/viewvc/llvm-project?rev=130219&view=rev
Log:
LNT/Flask: Port simple schema's results page.

Added:
    zorg/trunk/lnt/lnt/server/ui/static/View2D.js   (with props)
    zorg/trunk/lnt/lnt/server/ui/static/sorttable.js   (with props)
    zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html
    zorg/trunk/lnt/lnt/server/ui/templates/simple_utils.html
Modified:
    zorg/trunk/lnt/lnt/db/perfdbsummary.py
    zorg/trunk/lnt/lnt/server/ui/filters.py
    zorg/trunk/lnt/lnt/server/ui/views.py

Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdbsummary.py?rev=130219&r1=130218&r2=130219&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/db/perfdbsummary.py (original)
+++ zorg/trunk/lnt/lnt/db/perfdbsummary.py Tue Apr 26 12:48:21 2011
@@ -91,6 +91,7 @@
         self.test_id_map = test_id_map
         self.parameter_keys = parameter_keys
         self.parameter_sets = parameter_sets
+        self.parameter_maps = map(dict, parameter_sets)
         self.test_info_map = dict([(v,k) for k,v in test_id_map.items()])
 
     def is_up_to_date(self, db):

Modified: zorg/trunk/lnt/lnt/server/ui/filters.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/filters.py?rev=130219&r1=130218&r2=130219&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/filters.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/filters.py Tue Apr 26 12:48:21 2011
@@ -1,10 +1,15 @@
 import datetime
+from lnt.viewer.Util import PctCell
 
 def filter_asusertime(time):
     # FIXME: Support alternate timezones?
     ts = datetime.datetime.fromtimestamp(time)
     return ts.strftime('%Y-%m-%d %H:%M:%S %Z PST')
 
+def filter_aspctcell(value, *args, **kwargs):
+    cell = PctCell(value, *args, **kwargs)
+    return cell.render()
+
 def register(app):
     for name,object in globals().items():
         if name.startswith('filter_'):

Added: zorg/trunk/lnt/lnt/server/ui/static/View2D.js
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/static/View2D.js?rev=130219&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/static/View2D.js (added)
+++ zorg/trunk/lnt/lnt/server/ui/static/View2D.js Tue Apr 26 12:48:21 2011
@@ -0,0 +1 @@
+link ../../../viewer/js/View2D.js
\ No newline at end of file

Propchange: zorg/trunk/lnt/lnt/server/ui/static/View2D.js
------------------------------------------------------------------------------
    svn:special = *

Added: zorg/trunk/lnt/lnt/server/ui/static/sorttable.js
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/static/sorttable.js?rev=130219&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/static/sorttable.js (added)
+++ zorg/trunk/lnt/lnt/server/ui/static/sorttable.js Tue Apr 26 12:48:21 2011
@@ -0,0 +1 @@
+link ../../../viewer/resources/sorttable.js
\ No newline at end of file

Propchange: zorg/trunk/lnt/lnt/server/ui/static/sorttable.js
------------------------------------------------------------------------------
    svn:special = *

Added: zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html?rev=130219&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html Tue Apr 26 12:48:21 2011
@@ -0,0 +1,208 @@
+{% import "simple_utils.html" as simple_utils %}
+{% import "utils.html" as utils %}
+
+{% set db = request.get_db() %}
+{% set run = db.getRun(id) %}
+{% set machine = run.machine %}
+
+{% extends "layout.html" %}
+{% set components = [(tag, db_url_for("simple_overview", tag=tag)),
+                     ('machine', db_url_for("simple_machine",
+                                            tag=tag, id=machine.id))] %}
+{% block head %}
+        <script src="{{ url_for('.static', filename='popup.js') }}"></script>
+        <script src="{{ url_for('.static', filename='sorttable.js') }}"></script>
+        <script src="{{ url_for('.static', filename='View2D.js') }}"></script>
+{% endblock %}
+{
+{% block title %}Run Results{% endblock %}
+
+{# Add JS to run the init_report function, if embedded. #}
+{% block onload %}init(){% endblock %}
+{% block javascript %}
+function init() {
+    if (init_report) {
+        init_report();
+    }
+}
+{% endblock %}
+
+{% block body %}
+
+{% macro get_cell_value(cr) %}
+{% set test_status = cr.get_test_status() %}
+{% set value_status = cr.get_value_status() %}
+{% set run_cell_value = "-" if cr.current is none else "%.4f" % cr.current %}
+
+{% set cell_color = none %}
+{% if test_status == runinfo.REGRESSED %}
+    {% set cell_color = (233,128,128) %}
+{% elif test_status == runinfo.IMPROVED %}
+    {% set cell_color = (143,223,95) %}
+{% elif test_status == runinfo.UNCHANGED_FAIL %}
+    {% set cell_color = (255,195,67) %}
+{% endif %}
+
+{% if cell_color %}
+    <td bgcolor="{{ '#%02x%02x%02x' % cell_color }}">{{
+      run_cell_value}}</td>
+{% else %}
+    <td>{{run_cell_value}}</td>
+{% endif %}
+
+{% if (options.show_all or
+       value_status == runinfo.REGRESSED or
+       value_status == runinfo.IMPROVED) %}
+    {{ cr.pct_delta|aspctcell|safe }}
+{% else %}
+    <td>-</td>
+{% endif %}
+
+{% if options.show_delta %}
+    <td>{{ "-" if cr.delta is none else "%.4f" % cr.delta }}</td>
+{% endif %}
+{% if options.show_stddev %}
+    <td>{{ "-" if cr.stddev is none else "%.4f" % cr.stddev }}</td>
+{% endif %}
+{% if options.show_mad %}
+    <td>{{ "-" if cr.MAD is none else "%.4f" % cr.MAD }}</td>
+{% endif %}
+{% if options.show_all_samples %}
+    <td>[
+      {%- for v in cr.get_samples() -%}
+        {{ ", " if not loop.first }}
+        {{ "%.4f" % v }}
+      {%- endfor -%}]</td>
+{% endif %}
+
+{% if options.show_sample_counts %}
+    <td>{{cr.get_samples()|length}}</td>
+{% endif %}
+
+{% endmacro %}
+
+{% call simple_utils.simple_run_page(machine, run, compare_to,
+                                     neighboring_runs) %}
+
+{{ utils.render_popup_begin('view_options', 'View Options', true) }}
+<form action="" method="get">
+<b>Show Delta:</b>
+<input type="checkbox" name="show_delta" value="yes"><br>
+
+<b>Show Standard Deviation:</b>
+<input type="checkbox" name="show_stddev" value="yes"><br>
+
+<b>Show Median Absolute Deviation:</b>
+<input type="checkbox" name="show_mad" value="yes"><br>
+
+<b>Show All Values:</b>
+<input type="checkbox" name="show_all" value="yes"><br>
+
+<b>Show All Samples:</b>
+<input type="checkbox" name="show_all_samples" value="yes"><br>
+
+<b>Show Sample Counts:</b>
+<input type="checkbox" name="show_sample_counts" value="yes"><br>
+
+<b>Number of Comparison Runs:</b>
+<input type="text" name="num_comparison_runs" value="10"><br>
+
+<b>Show Report Graphs:</b>
+<input type="checkbox" name="show_graphs" value="yes"><br>
+
+<input type="submit" name="submit" value="Update">
+</form>
+{{ utils.render_popup_end() }}
+
+{{ utils.render_popup_begin('text_report', 'Report (Text)', true) }}
+<pre>{{ text_report }}</pre>
+{{ utils.render_popup_end() }}
+
+{{ utils.render_popup_begin('html_report', 'Report (HTML)', false) }}
+{{html_report|safe}}
+{{ utils.render_popup_end() }}
+
+<h3>Parameter Sets</h3>
+<table border=1>
+  <tr>
+    <th rowspan=2>Name</th>
+    <th colspan={{ts_summary.parameter_sets|length}}>Parameters</th>
+  </tr>
+  <tr>
+{% for key in ts_summary.parameter_keys %}
+    <th>{{key}}</th>
+{% endfor %}
+  </tr>
+
+{% for pmap in ts_summary.parameter_maps %}
+  <tr>
+    <td>P{{loop.index0}}</td>
+    {% for key in ts_summary.parameter_keys %}
+        {% set item = pmap.get(key) %}
+    <td>{{ "-" if item is none else item }}</td>
+    {% endfor %}
+  </tr>
+{% endfor %}
+</table>
+
+<h3>Tests</h3>
+
+{% set pset_cols = (
+      2 + options.show_delta + options.show_stddev + options.show_mad +
+      options.show_all_samples + options.show_sample_counts) %}
+
+<form method="GET" action="graph">
+<table class="sortable" border=1>
+<thead>
+  <tr>
+    <th rowspan="1"></th>
+    <th rowspan="1">Name</th>
+{% for key in ts_summary.parameter_sets %}
+    <th colspan="{{pset_cols}}">P{{loop.index0}}</th>
+{% endfor %}
+  </tr>
+  <tr>
+    <th></th>
+    <th></th>
+{% for key in ts_summary.parameter_sets %}
+    <th><input type="checkbox" name="pset.{{loop.index0}}"
+               value="on" checked></th>
+{% endfor %}
+    <th>%</th>
+    {% if options.show_delta %}
+    <th>Δ</th>
+    {% endif %}
+    {% if options.show_stddev %}
+    <th>σ</th>
+    {% endif %}
+    {% if options.show_mad %}
+    <th>MAD</th>
+    {% endif %}
+    {% if options.show_all_samples %}
+    <th>Samples</th>
+    {% endif %}
+    {% if options.show_sample_counts %}
+    <th>N</th>
+    {% endif %}
+  </tr>
+</thead>
+
+{% for name in test_names|sort %}
+  <tr>
+    <td><input type="checkbox" name="test.{{name}}"></td>
+    <td>{{name}}</td>
+    {% for pset in ts_summary.parameter_sets %}
+      {% set cr = simple_run_info.get_run_comparison_result(
+            run, run_status_kind, compare_to, compare_to_status_kind,
+            name, pset, comparison_window) %}
+        {{ get_cell_value(cr) }}
+    {% endfor %}
+  </tr>
+{% endfor %}
+</table>
+<input type="submit" value="Graph">
+</form>
+
+{% endcall %}
+
+{% endblock %}

Added: zorg/trunk/lnt/lnt/server/ui/templates/simple_utils.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/simple_utils.html?rev=130219&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/simple_utils.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/simple_utils.html Tue Apr 26 12:48:21 2011
@@ -0,0 +1,85 @@
+{% import "utils.html" as utils %}
+
+{% macro simple_run_page(machine, run, compare_to,
+                         neighboring_runs) %}
+
+<center>
+  <table>
+    <tr>
+      <td align=right>Machine:</td>
+      <td>{{machine.name}}:{{machine.number}}</td>
+    </tr>
+    <tr>
+      <td align=right>Run:</td>
+      <td>{{run.start_time}} ({{
+        run.info['run_order'].value}})</td>
+    </tr>
+{% if compare_to %}
+    <tr>
+      <td align=right>Compare To:</td>
+      <td>{{compare_to.start_time}} ({{
+        compare_to.info['run_order'].value}})</td>
+    </tr>
+{% endif %}
+  </table>
+</center>
+<p>
+
+<table width="100%%" border=1>
+  <tr>
+    <td valign="top" width="200">
+      <a href="..">Homepage</a>
+      <h4>Machine:</h4>
+      <a href="{{ db_url_for('simple_machine', tag=tag, id=machine.id) }}">{{
+        machine.name}}:{{machine.number}}</a>
+      <h4>Runs:</h4>
+      <ul>
+
+{# Show a small number of neighboring runs. #}
+{% for r in neighboring_runs %}
+        <li>{{ "<h3>"|safe if r.id == run.id }}
+            <a href="{{db_url_for('simple_run', tag=tag, id=id)}}">{{
+                     r.start_time}}</a>{{
+            "</h3>"|safe if r.id == run.id }}
+{% endfor %}
+      </ul>
+    </td>
+    <td valign="top">
+      <table border=1>
+      <tr>
+        <td> <b>Nickname</b> </td>
+        <td> {{machine.name}} </td>
+      </tr>
+      <tr>
+        <td> <b>Machine ID</b> </td>
+        <td> {{machine.id}} </td>
+      </tr>
+      </table>
+{{ utils.render_popup_begin('machine_info', 'Machine Info', true) }}
+      <table border=1>
+{% for key,item in machine.info|dictsort(true) %}
+      <tr>
+        <td> <b>{{key}}</b> </td>
+        <td>{{item.value}}</td>
+      </tr>
+{% endfor %}
+      </table>
+{{ utils.render_popup_end() }}
+
+{{ utils.render_popup_begin('run_info', 'Run Info', true) }}
+      <table border=1>
+{% for key,item in run.info|dictsort(true) %}
+      <tr>
+        <td> <b>{{key}}</b> </td>
+        <td>{{item.value}}</td>
+      </tr>
+{% endfor %}
+      </table>
+{{ utils.render_popup_end() }}
+{{ caller() }}
+
+    </td>
+  </tr>
+</table>
+
+{% endmacro %}

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=130219&r1=130218&r2=130219&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Tue Apr 26 12:48:21 2011
@@ -101,7 +101,9 @@
 # Simple LNT Schema Viewer
 
 from lnt.db.perfdb import Machine, Run, RunInfo
+from lnt.db import runinfo
 from lnt.db import perfdbsummary
+from lnt.util import NTEmailReport
 
 @db_route("/simple/<tag>")
 def simple_overview(tag):
@@ -155,4 +157,93 @@
 
 @db_route("/simple/<tag>/<id>")
 def simple_run(tag, id):
-    raise NotImplementedError
+    db = request.get_db()
+
+    run = db.getRun(id)
+
+    # Get the run summary.
+    run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag)
+    ts_summary = perfdbsummary.get_simple_suite_summary(db, tag)
+    sri = runinfo.SimpleRunInfo(db, ts_summary)
+
+    # Get the comparison run.
+    compare_to = None
+    compare_to_id = request.args.get('compare')
+    if compare_to_id is not None:
+        try:
+            compare_to = db.getRun(int(compare_to_id))
+        except:
+            pass
+    if compare_to is None:
+        prev_id = run_summary.get_previous_run_on_machine(run.id)
+        if prev_id is not None:
+            compare_to = db.getRun(prev_id)
+
+    # Get the neighboring runs.
+    cur_id = run.id
+    for i in range(3):
+        next_id = run_summary.get_next_run_on_machine(cur_id)
+        if not next_id:
+            break
+        cur_id = next_id
+    neighboring_runs = []
+    for i in range(6):
+        neighboring_runs.append(db.getRun(cur_id))
+        cur_id = run_summary.get_previous_run_on_machine(cur_id)
+        if cur_id is None:
+            break
+
+    # Parse the view options.
+    options = {}
+    options['show_graphs'] = bool(request.args.get('show_graphs'))
+    options['show_delta'] = bool(request.args.get('show_delta'))
+    options['show_stddev'] =  bool(request.args.get('show_stddev'))
+    options['show_mad'] = bool(request.args.get('show_mad'))
+    options['show_all'] = bool(request.args.get('show_all'))
+    options['show_all_samples'] = bool(request.args.get('show_all_samples'))
+    options['show_sample_counts'] = bool(request.args.get('show_sample_counts'))
+    options['show_graphs'] = show_graphs = bool(request.args.get('show_graphs'))
+    try:
+        num_comparison_runs = int(request.args.get('num_comparison_runs'))
+    except:
+        num_comparison_runs = 10
+    options['num_comparison_runs'] = num_comparison_runs
+
+    _, text_report, html_report = NTEmailReport.getSimpleReport(
+        None, db, run, str("%s/db_%s/") % (current_app.old_config.zorgURL,
+                                           g.db_name),
+        True, True, only_html_body = True, show_graphs = show_graphs,
+        num_comparison_runs = num_comparison_runs)
+
+    # Get the test status style used in each run.
+    run_status_kind = run_summary.get_run_status_kind(db, run.id)
+    if compare_to:
+        compare_to_status_kind = run_summary.get_run_status_kind(
+            db, compare_to.id)
+    else:
+        compare_to_status_kind = None
+
+    # Get the list of tests we are interest in.
+    interesting_runs = [run.id]
+    if compare_to:
+        interesting_runs.append(compare_to.id)
+    test_names = ts_summary.get_test_names_in_runs(db, interesting_runs)
+
+    # Gather the runs to use for statistical data, if enabled.
+    cur_id = run.id
+    comparison_window = []
+    for i in range(num_comparison_runs):
+        cur_id = run_summary.get_previous_run_on_machine(cur_id)
+        if not cur_id:
+            break
+        comparison_window.append(cur_id)
+
+    return render_template("simple_run.html", tag=tag, id=id,
+                           compare_to=compare_to,
+                           compare_to_status_kind=compare_to_status_kind,
+                           run_summary=run_summary, ts_summary=ts_summary,
+                           simple_run_info=sri, test_names=test_names,
+                           neighboring_runs=neighboring_runs,
+                           text_report=text_report, html_report=html_report,
+                           options=options, runinfo=runinfo,
+                           comparison_window=comparison_window)





More information about the llvm-commits mailing list