[llvm-commits] [LNT] r161813 - in /lnt/trunk/lnt/server/ui: static/v4_global_status.css templates/v4_global_status.html templates/v4_overview.html views.py
Daniel Dunbar
daniel at zuster.org
Thu Aug 16 10:15:36 PDT 2012
Awesome!
Some comments inline (and apologies if they get fixed up in later
commits, I am FIFO)...
On Mon, Aug 13, 2012 at 5:25 PM, Michael Gottesman <mgottesman at apple.com> wrote:
> Author: mgottesman
> Date: Mon Aug 13 19:25:56 2012
> New Revision: 161813
>
> URL: http://llvm.org/viewvc/llvm-project?rev=161813&view=rev
> Log:
> [LNT] Commit of initial version of global status page.
>
> This page shows the performance change of all tests on all machines from the previous day against a particular baseline.
>
> Added:
> lnt/trunk/lnt/server/ui/static/v4_global_status.css
> lnt/trunk/lnt/server/ui/templates/v4_global_status.html
> Modified:
> lnt/trunk/lnt/server/ui/templates/v4_overview.html
> lnt/trunk/lnt/server/ui/views.py
>
> Added: lnt/trunk/lnt/server/ui/static/v4_global_status.css
> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/v4_global_status.css?rev=161813&view=auto
> ==============================================================================
> --- lnt/trunk/lnt/server/ui/static/v4_global_status.css (added)
> +++ lnt/trunk/lnt/server/ui/static/v4_global_status.css Mon Aug 13 19:25:56 2012
> @@ -0,0 +1,47 @@
> +
> +table#data-table tr {
> + width: 100%;
> +}
> +
> +table#data-table th {
> + outline: rgba(0, 0, 0, 0.3) solid 1px;
> +}
> +
> +/* Turn off text select */
> +table#data-table {
> + -moz-user-select: none;
> + -khtml-user-select: none;
> + -webkit-user-select: none;
> + user-select: none;
> + margin-right: 10px;
> + cursor: default;
> +}
> +
> +table#data-table td {
> + border: rgba(0, 0, 0, 0.3) solid 1px;
> +}
> +
> +table#data-table td.data-cell, table#data-table th {
> + text-align: center;
> +}
> +
> +table#data-table td.data-cell, table#data-table th.data-header {
> + min-width: 15em;
> + max-width: 15em;
> + width: 15em;
> +}
> +
> +table#data-table td.row-head {
> + min-width: 30em;
> + max-width: 30em;
> + width: 30em;
> +}
> +
> +table#data-table th.label-header {
> + width: auto;
> +}
> +
> +table#data-table td.row-head {
> + text-align: left;
> + overflow: hidden;
> +}
>
> Added: lnt/trunk/lnt/server/ui/templates/v4_global_status.html
> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_global_status.html?rev=161813&view=auto
> ==============================================================================
> --- lnt/trunk/lnt/server/ui/templates/v4_global_status.html (added)
> +++ lnt/trunk/lnt/server/ui/templates/v4_global_status.html Mon Aug 13 19:25:56 2012
> @@ -0,0 +1,37 @@
> +{% import "v4_utils.html" as v4_utils %}
> +{% import "utils.html" as utils %}
> +
> +{% extends "layout.html" %}
> +{% set components = [(ts.name, v4_url_for("v4_global_status"))] %}
> +{% block head %}
> + <link type="text/css" rel="stylesheet"
> + href="{{ url_for('.static', filename='v4_global_status.css') }}"></link>
> + <script async src="{{ url_for('.static', filename='popup.js') }}"></script>
> + <script async src="{{ url_for('.static', filename='sorttable.js') }}"></script>
> +{% endblock %}
> +
> +{% block title %}Global Status - {{
> + selected_field.name.replace("_", " ").title() }}{% endblock %}
We should move the title computation into a property on the field
object (.title), which eventually should become metadata.
> +{% block body %}
> +<table id="data-table" class="sortable_rev">
> + <tr id="data-table-header">
> + <th class="label-header">Test</th>
> + <th id="worst-time-header" class="data-header worst-time">Worst Time</th>
> + {% for m in machines %}
> + <th class="data-header">{{ m.name }}</th>
> + {% endfor %}
> + </tr>
> + {% for row in tests %}
> + <tr>
> + <td class="row-head">
> + {{ row[0] }}
> + </td>
> + {{ row[1]|aspctcell("data-cell worst-time")|safe }}
> + {% for cr in row[2:] %}
> + {{ cr.pct_delta|aspctcell("data-cell worst-time")|safe }}
> + {% endfor %}
> + </tr>
> + {% endfor %}
> +</table>
> +{% endblock %}
>
> Modified: lnt/trunk/lnt/server/ui/templates/v4_overview.html
> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_overview.html?rev=161813&r1=161812&r2=161813&view=diff
> ==============================================================================
> --- lnt/trunk/lnt/server/ui/templates/v4_overview.html (original)
> +++ lnt/trunk/lnt/server/ui/templates/v4_overview.html Mon Aug 13 19:25:56 2012
> @@ -5,6 +5,10 @@
> {% block title %}Overview{% endblock %}
> {% block body %}
>
> +<center><h3>Compiler Status Pages</h3></center>
> +<a href="{{ v4_url_for('v4_global_status', field=2) }}">Compile Time</a>
> +<a href="{{ v4_url_for('v4_global_status', field=3) }}">Execution Time</a>
This shouldn't hard code field names or IDs. This is only going to be
right for one kind of test suite, and that can change.
> {# Find recent runs. #}
> <center><h3>Submission Overview</h3></center>
> <table width="100%%">
>
> Modified: lnt/trunk/lnt/server/ui/views.py
> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=161813&r1=161812&r2=161813&view=diff
> ==============================================================================
> --- lnt/trunk/lnt/server/ui/views.py (original)
> +++ lnt/trunk/lnt/server/ui/views.py Mon Aug 13 19:25:56 2012
> @@ -3,6 +3,9 @@
> import re
> import tempfile
> import time
> +import csv
> +import cStringIO
> +import json
>
> import flask
> from flask import abort
> @@ -14,6 +17,8 @@
> from flask import request
> from flask import url_for
>
> +import sqlalchemy.sql
> +
> import lnt.util
> import lnt.util.ImportData
> import lnt.util.stats
> @@ -21,6 +26,7 @@
> import lnt.server.reporting.analysis
> import lnt.server.reporting.runs
> from lnt.server.ui.decorators import frontend, db_route, v4_route
> +import lnt.server.ui.util
>
> ###
> # Root-Only Routes
> @@ -492,7 +498,7 @@
> errorbar_data = []
> points_data = []
> pts = []
> -
> +
Please try and commit whitespace changes in independent code
separately, they make content-ful patches harder to read.
- Daniel
> # Create region of interest for run data region if
> # we are performing a comparison.
> if compare_to:
> @@ -502,7 +508,7 @@
> convert_revision(start_rev),
> convert_revision(end_rev)
> )
> -
> +
> if normalize_by_median:
> normalize_by = 1.0/stats.median([min(values)
> for _,values in data])
> @@ -572,14 +578,14 @@
> style = "new Graph2D_LinePlotStyle(2, %r)" % (reglin_col,)
> graph_plots.append("graph.addPlot([%s], %s);" % (
> pts,style))
> -
> - # If we are comparing two revisions,
> +
> + # If we are comparing two revisions,
> if compare_to:
> reg_col = [0.0, 0.0, 1.0]
> graph_plots.append("graph.addPlot([%i, %i],%s);" % (
> revision_range_region[0], revision_range_region[1],
> "new Graph2D_RangePlotStyle(%r)" % reg_col))
> -
> +
> # Add the points plot, if used.
> if points_data:
> pts_col = (0,0,0)
> @@ -623,6 +629,97 @@
> return redirect(v4_url_for("v4_daily_report",
> year=date.year, month=date.month, day=date.day))
>
> + at v4_route("/global_status")
> +def v4_global_status():
> + from lnt.server.ui import util
> +
> + ts = request.get_testsuite()
> +
> + # Get the latest run.
> + latest = ts.query(ts.Run.start_time).\
> + order_by(ts.Run.start_time.desc()).first()
> +
> + # If we found an entry, use that.
> + if latest is not None:
> + latest_date, = latest
> + else:
> + # Otherwise, just use today.
> + latest_date = datetime.date.today()
> +
> + # Create a datetime for the day before the most recent run.
> + yesterday = latest_date - datetime.timedelta(days=1)
> +
> + # Get the revision number for a nondefault baseline if we
> + # are given one.
> + revision = ts.Machine.DEFAULT_BASELINE_REVISION
> + field = ts.Sample.get_primary_fields().next()
> +
> + # Get the list of all runs we might be interested in.
> + recent_runs = ts.query(ts.Run).filter(ts.Run.start_time > yesterday).all()
> +
> + # Aggregate the runs by machine.
> + recent_runs_by_machine = util.multidict()
> + for run in recent_runs:
> + recent_runs_by_machine[run.machine] = run
> +
> + # Get a sorted list of recent machines.
> + recent_machines = sorted(recent_runs_by_machine.keys(),
> + key=lambda m: m.name)
> +
> + # For each machine, build a table of the machine, the baseline run, and the
> + # most recent run. We also computed a list of all the runs we are reporting
> + # over.
> + machine_run_info = []
> + reported_run_ids = []
> + for machine in recent_machines:
> + runs = recent_runs_by_machine[machine]
> +
> + # Get the baseline run for this machine.
> + baseline = machine.get_baseline_run(revision)
> +
> + # Choose the "best" run to report on. We want the most recent one with
> + # the most recent order.
> + run = max(runs, key=lambda r: (r.order, r.start_time))
> +
> + machine_run_info.append((baseline, run))
> + reported_run_ids.append(baseline.id)
> + reported_run_ids.append(run.id)
> +
> + # Get the set all tests reported in the recent runs.
> + reported_tests = ts.query(ts.Test.id, ts.Test.name).filter(
> + sqlalchemy.sql.exists('*', sqlalchemy.sql.and_(
> + ts.Sample.run_id.in_(reported_run_ids),
> + ts.Sample.test_id == ts.Test.id))).all()
> +
> + # Load all of the runs we are interested in.
> + runinfo = lnt.server.reporting.analysis.RunInfo(ts, reported_run_ids)
> +
> + # Build the test matrix. This is a two dimensional table index by
> + # (machine-index, test-index), where each entry is the percent change.
> + test_table = []
> + for i,(test_id,test_name) in enumerate(reported_tests):
> + # Create the row, starting with the test name and worst entry.
> + row = [test_name, None]
> +
> + # Compute comparison results for each machine.
> + row.extend(runinfo.get_run_comparison_result(run, baseline, test_id,
> + field)
> + for baseline,run in machine_run_info)
> +
> + # Compute the worst cell value.
> + row[1] = max(cr.pct_delta
> + for cr in row[2:])
> +
> + test_table.append(row)
> +
> + # Order the table by worst regression.
> + test_table.sort(key = lambda row: row[1], reverse=True)
> +
> + return render_template("v4_global_status.html",
> + ts=ts,
> + tests=test_table,
> + machines=recent_machines,
> + selected_field=field)
>
> @v4_route("/daily_report/<int:year>/<int:month>/<int:day>")
> def v4_daily_report(year, month, day):
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list