[llvm-commits] [zorg] r130222 - in /zorg/trunk/lnt/lnt: __init__.py server/ui/templates/simple_graph.html server/ui/templates/simple_run.html server/ui/views.py
Daniel Dunbar
daniel at zuster.org
Tue Apr 26 10:48:30 PDT 2011
Author: ddunbar
Date: Tue Apr 26 12:48:30 2011
New Revision: 130222
URL: http://llvm.org/viewvc/llvm-project?rev=130222&view=rev
Log:
LNT/Flask: Port simple graph page.
Added:
zorg/trunk/lnt/lnt/server/ui/templates/simple_graph.html
Modified:
zorg/trunk/lnt/lnt/__init__.py
zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html
zorg/trunk/lnt/lnt/server/ui/views.py
Modified: zorg/trunk/lnt/lnt/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/__init__.py?rev=130222&r1=130221&r2=130222&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/__init__.py (original)
+++ zorg/trunk/lnt/lnt/__init__.py Tue Apr 26 12:48:30 2011
@@ -1,6 +1,6 @@
__author__ = 'Daniel Dunbar'
__email__ = 'daniel at zuster.org'
-__versioninfo__ = (0, 3, 0)
+__versioninfo__ = (0, 3, 1)
__version__ = '.'.join(map(str, __versioninfo__)) + 'dev'
__all__ = []
Added: zorg/trunk/lnt/lnt/server/ui/templates/simple_graph.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/simple_graph.html?rev=130222&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/simple_graph.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/simple_graph.html Tue Apr 26 12:48:30 2011
@@ -0,0 +1,147 @@
+{% 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)),
+ ('run', db_url_for("simple_run",
+ 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 initialize the graph. #}
+{% block onload %}init(){% endblock %}
+{% block javascript %}
+function init() {
+ graph = new Graph2D("graph");
+ graph.clearColor = [1, 1, 1];
+
+ {{ graph_plots }}
+
+ graph.xAxis.format = graph.xAxis.formats.normal;
+ graph.draw();
+}
+{% endblock %}
+
+{% block body %}
+
+{% call simple_utils.simple_run_page(tag, machine, run, compare_to,
+ neighboring_runs) %}
+
+{{ utils.render_popup_begin('view_options', 'View Options', true) }}
+<form action="" method="get">
+<b>Show Median Absolute Deviation:</b>
+<input type="checkbox" name="show_mad" value="yes"><br>
+
+<b>Show Standard Deviation:</b>
+<input type="checkbox" name="show_stddev" value="yes"><br>
+
+<b>Show Linear Regression:</b>
+<input type="checkbox" name="show_linear_regression" value="yes"><br>
+
+{# Add all the hidden fields. #}
+{% for name,value in request.args.items() %}
+ {% if name.startswith('test.') or name.startswith('pset.') %}
+ <input type="hidden" name="{{name}}" value="{{value}}"><br>
+ {% endif %}
+{% endfor %}
+
+<input type="submit" name="submit" value="Update">
+</form>
+{{ utils.render_popup_end() }}
+
+<h3>Graph</h3>
+<table>
+<tr>
+<td rowspan=2 valign="top">
+ <canvas id="graph" width="600" height="400"></canvas>
+</td>
+<td valign="top">
+<table cellspacing=4 border=1>
+<tr><th colspan=2>Test</th></tr>
+{% for name,col in legend %}
+ <tr><td bgcolor="{{ '%02x%02x%02x' % (
+ 255*col[0], 255*col[1], 255*col[2]) }}"> </td>
+ <td>{{name}}</td></tr>
+{% endfor %}
+</table>
+</td></tr>
+<tr><td align="right" valign="bottom">
+<font size="-2">
+Shift-Left Mouse: Pan<br>
+Alt/Meta-Left Mouse: Zoom<br>
+Wheel: Zoom (<i>Shift Slows</i>)<br>
+</font>
+</td></tr>
+</table>
+<p>
+<b>Plots</b>: {{ num_plots }}<br>
+<b>Num Points</b>: {{ num_points }}<br>
+
+<h2>Deltas</h2>
+{% for deltas in plot_deltas %}
+ {% set (name,col) = legend[loop.index0] %}
+<h3>{{name}}</h3>
+<table>
+<tr>
+ <th colspan=2>Revision</th>
+ <th> </th>
+ <th colspan=2>Value</th>
+ <th></th>
+ <th></th>
+ <th colspan=2>MAD</th>
+ <th colspan=2>Med - Min</th>
+<tr>
+ <th>Current</th>
+ <th>Previous</th>
+ <th>Delta (%)</th>
+ <th>Current</th>
+ <th>Previous</th>
+ <th># Revs</th>
+ <th> </th>
+ <th>Current</th>
+ <th>Previous</th>
+ <th>Current</th>
+ <th>Previous</th>
+</tr>
+
+{% for (pct,(r0,t0,mad0,med0),(r1,t1,mad1,med1)) in deltas %}
+<tr>
+ <td><a href="http://llvm.org/viewvc/llvm-project?view=rev&revision={{r1}}">{{r1}}</a></td>
+ <td><a href="http://llvm.org/viewvc/llvm-project?view=rev&revision={{r0}}">{{r0}}</a></td>
+ {{pct|aspctcell(delta=true)|safe}}
+ <td>{{ "%.4f" % t1 }}</td><td>{{ "%.4f" % t0}}</td>
+ <td>{{ r1 - r0 }}</td>
+ <td> </td>
+ <td>{{ "%.4f" % mad1 }}</td><td>{{ "%.4f" % mad0 }}</td>
+ <td>{{ "%.4f" % (med1-t1) }}</td><td>{{ "%.4f" % (med0-t0) }}</td>
+</tr>
+{% endfor %}
+
+</table>
+{% endfor %}
+
+<h3>Revisions to Sample</h3>
+{% for rev in new_sample_list %}
+ {{ rev }}
+{% endfor %}
+<p>
+<h3>Revisions to Resample</h3>
+{% for rev in resample_list|sort %}
+ {{ rev }}
+{% endfor %}
+<p>
+
+{% endcall %}
+
+{% endblock %}
Modified: 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=130222&r1=130221&r2=130222&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/simple_run.html Tue Apr 26 12:48:30 2011
@@ -14,7 +14,7 @@
<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. #}
@@ -151,7 +151,8 @@
2 + options.show_delta + options.show_stddev + options.show_mad +
options.show_all_samples + options.show_sample_counts) %}
-<form method="GET" action="graph">
+<form method="GET" action="{{ db_url_for('simple_graph',
+ tag=tag, id=id) }}">
<table class="sortable" border=1>
<thead>
<tr>
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=130222&r1=130221&r2=130222&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Tue Apr 26 12:48:30 2011
@@ -106,7 +106,7 @@
from lnt.db import perfdbsummary
from lnt.util import NTEmailReport
- at db_route("/simple/<tag>")
+ at db_route("/simple/<tag>/")
def simple_overview(tag):
db = request.get_db()
@@ -204,7 +204,7 @@
response.mimetype = "text/plain"
return response
- at db_route("/simple/<tag>/<id>")
+ at db_route("/simple/<tag>/<int:id>")
def simple_run(tag, id):
db, run, run_summary, compare_to = get_simple_run_info(tag, id)
@@ -279,3 +279,111 @@
text_report=text_report, html_report=html_report,
options=options, runinfo=runinfo,
comparison_window=comparison_window)
+
+ at db_route("/simple/<tag>/<int:id>/graph")
+def simple_graph(tag, id):
+ from lnt.viewer import GraphUtil
+ from lnt.viewer import Util
+
+ db, run, run_summary, compare_to = get_simple_run_info(tag, id)
+
+ # Get additional summaries.
+ ts_summary = perfdbsummary.get_simple_suite_summary(db, tag)
+
+ # 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 = {}
+ show_mad = bool(request.args.get('show_mad', True))
+ show_stddev = bool(request.args.get('show_stddev'))
+ show_linear_regression = bool(
+ request.args.get('show_linear_regression', True))
+
+ # Load the graph parameters.
+ graph_tests = []
+ graph_psets = []
+ for name,value in request.args.items():
+ if name.startswith(str('test.')):
+ graph_tests.append(name[5:])
+ elif name.startswith(str('pset.')):
+ graph_psets.append(ts_summary.parameter_sets[int(name[5:])])
+
+ # Get the test ids we want data for.
+ test_ids = [ts_summary.test_id_map[(name,pset)]
+ for name in graph_tests
+ for pset in graph_psets]
+
+ # Build the graph data
+ pset_id_map = dict([(pset,i)
+ for i,pset in enumerate(ts_summary.parameter_sets)])
+ legend = []
+ num_points = 0
+ plot_points = []
+ plots = ""
+ plots_iter = GraphUtil.get_test_plots(
+ db, run.machine, test_ids, run_summary, ts_summary,
+ show_mad_error = show_mad, show_stddev = show_stddev,
+ show_linear_regression = show_linear_regression, show_points = True)
+ for test_id, plot_js, col, points, ext_points in plots_iter:
+ test = db.getTest(test_id)
+ name = test.name
+ pset = test.get_parameter_set()
+
+ num_points += len(points)
+ legend.append(("%s : P%d" % (name, pset_id_map[pset]), tuple(col)))
+ plots += plot_js
+ plot_points.append(ext_points)
+
+ # Build the sample info.
+ resample_list = set()
+ new_sample_list = []
+ plot_deltas = []
+ for (name,col),points in zip(legend,plot_points):
+ points.sort()
+ deltas = [(Util.safediv(p1[1], p0[1]), p0, p1)
+ for p0,p1 in Util.pairs(points)]
+ deltas.sort()
+ deltas.reverse()
+ plot_deltas.append(deltas[:20])
+ for (pct,(r0,t0,mad0,med0),(r1,t1,mad1,med1)) in deltas[:20]:
+ # Find the best next revision to sample, unless we have
+ # sampled to the limit. To conserve resources, we try to
+ # align to the largest "nice" revision boundary that we can,
+ # so that we tend to sample the same revisions, even as we
+ # drill down.
+ assert r0 < r1 and r0 != r1
+ if r0 + 1 != r1:
+ for align in [scale * boundary
+ for scale in (100000,10000,1000,100,10,1)
+ for boundary in (5, 1)]:
+ r = r0 + 1 + (r1 - r0)//2
+ r = (r // align) * align
+ if r0 < r < r1:
+ new_sample_list.append(r)
+ break
+
+ resample_list.add(r0)
+ resample_list.add(r1)
+
+ return render_template("simple_graph.html", tag=tag, id=id,
+ compare_to=compare_to,
+ neighboring_runs=neighboring_runs,
+ run_summary=run_summary, ts_summary=ts_summary,
+ graph_plots=plots, legend=legend,
+ num_plots=len(test_ids), num_points=num_points,
+ new_sample_list=new_sample_list,
+ resample_list=resample_list,
+ plot_deltas=plot_deltas)
+
More information about the llvm-commits
mailing list