[llvm-commits] [zorg] r132155 - in /zorg/trunk/lnt/lnt/server/ui: templates/simple_order_aggregate_report.html views.py

Daniel Dunbar daniel at zuster.org
Thu May 26 15:00:49 PDT 2011


Author: ddunbar
Date: Thu May 26 17:00:49 2011
New Revision: 132155

URL: http://llvm.org/viewvc/llvm-project?rev=132155&view=rev
Log:
LNT/UI: Start sketching a UI for viewing aggregate data by run order (revision).

Added:
    zorg/trunk/lnt/lnt/server/ui/templates/simple_order_aggregate_report.html
Modified:
    zorg/trunk/lnt/lnt/server/ui/views.py

Added: zorg/trunk/lnt/lnt/server/ui/templates/simple_order_aggregate_report.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/simple_order_aggregate_report.html?rev=132155&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/simple_order_aggregate_report.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/simple_order_aggregate_report.html Thu May 26 17:00:49 2011
@@ -0,0 +1,49 @@
+{% import "simple_utils.html" as simple_utils %}
+{% import "utils.html" as utils %}
+
+{% set db = request.get_db() %}
+
+{% extends "layout.html" %}
+{% set components = [(tag, db_url_for("simple_overview", tag=tag))] %}
+
+{% block title %}Order Aggregate Report{% endblock %}
+
+{% block body %}
+
+<h1>Order Aggregate Report</h1>
+
+{% for subset_name,subset_table in data_table|dictsort %}
+<h2>{{ subset_name }}</h2>
+
+<table>
+<thead>
+  <tr>
+    <th>Test Name</th>
+    <th>Machine</th>
+{% for order in orders_to_aggregate %}
+    <th>{{ order }}</th>
+{% endfor %}
+  </tr>
+</thead>
+
+{% set num_machines = available_machines|length %}
+{% for test_name,test_data in subset_table|dictsort %}
+{%   for machine in available_machines %}
+{%     set machine_idx = loop.index0 %}
+<tr>
+{%     if loop.index0 == 0 %}
+  <td rowspan="{{num_machines}}">{{ test_name }}</td>
+{%     endif %}
+  <td>{{ machine.name }}</td>
+{%     for order in orders_to_aggregate %}
+  <td>{{ test_data[loop.index0][machine_idx] }}</td>
+{%     endfor %}
+</tr>
+
+{%   endfor %}
+{% endfor %}
+</table>
+
+{% endfor %}
+
+{% endblock %}

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=132155&r1=132154&r2=132155&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Thu May 26 17:00:49 2011
@@ -146,7 +146,7 @@
 ###
 # Simple LNT Schema Viewer
 
-from lnt.db.perfdb import Machine, Run, RunInfo
+from lnt.db.perfdb import Machine, Run, RunInfo, Sample
 from lnt.db import runinfo
 from lnt.db import perfdbsummary
 from lnt.util import NTEmailReport
@@ -449,3 +449,110 @@
                            resample_list=resample_list,
                            plot_deltas=plot_deltas)
 
+ at db_route("/simple/<tag>/order_aggregate_report")
+def simple_order_aggregate_report(tag):
+    from lnt.viewer import Util
+
+    db = request.get_db()
+
+    # Get the run summary.
+    run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag)
+    # Load the test suite summary.
+    ts_summary = perfdbsummary.get_simple_suite_summary(db, tag)
+    # Get the run pass/fail information.
+    sri = runinfo.SimpleRunInfo(db, ts_summary)
+
+    # Get this list of orders we are aggregating over.
+    orders_to_aggregate = request.args.get('orders', '')
+    orders_to_aggregate = orders_to_aggregate.split(',')
+
+    # Collect the runs, aggregated by order and machine.
+    runs_to_summarize = []
+    runs_by_machine_and_order = Util.multidict()
+    available_machine_ids = set()
+    for order in orders_to_aggregate:
+        for id in run_summary.runs_by_order["%7s" % order]:
+            r = db.getRun(id)
+            runs_to_summarize.append(r)
+            available_machine_ids.add(r.machine_id)
+            runs_by_machine_and_order[(r.machine_id, order)] = r
+    available_machine_ids = list(available_machine_ids)
+    available_machine_ids.sort()
+    available_machines = [db.getMachine(id)
+                          for id in available_machine_ids]
+
+    # We currently only compare the null pset.
+    pset = ()
+
+    # Get the list of tests we are interested in.
+    test_names = ts_summary.get_test_names_in_runs(db, (
+            r.id for r in runs_to_summarize))
+
+    # Create test subsets, by name.
+    test_subsets = Util.multidict()
+    for test_name in test_names:
+        if '.' in test_name:
+            subset = test_name.rsplit('.', 1)[1]
+        else:
+            subset = test_name, ''
+        test_subsets[subset] = test_name
+
+    # Convert subset names to pretty form.
+    def convert((subset, tests)):
+        subset_name = { "compile" : "Compile Time",
+                        "exec" : "Execution Time" }.get(subset, subset)
+        return (subset_name, tests)
+    test_subsets = dict(convert(item) for item in test_subsets.items())
+
+    # Batch load all the samples for all the runs we are interested in.
+    start_time = time.time()
+    all_samples = db.session.query(Sample.run_id, Sample.test_id,
+                                   Sample.value).\
+                                   filter(Sample.run_id.in_(
+            r.id for r in runs_to_summarize))
+    all_samples = list(all_samples)
+
+    # Aggregate samples for easy lookup.
+    aggregate_samples = Util.multidict()
+    for run_id, test_id, value in all_samples:
+        aggregate_samples[(run_id, test_id)] = value
+
+    # Create the data table as:
+    #  data_table[subset_name][test_name][order index][machine index] = (
+    #    status samples, samples)
+    def get_test_samples(machine_id, test_name, order):
+        status_name = test_name + '.status'
+        status_test_id = ts_summary.test_id_map.get(
+            (status_name, pset))
+        test_id = ts_summary.test_id_map.get(
+            (test_name, pset))
+
+        status_samples = []
+        samples = []
+        for run in runs_by_machine_and_order.get((machine_id,order), []):
+            status_samples.extend(aggregate_samples.get(
+                    (run.id, status_test_id), []))
+            if status_samples:
+                print test_name,status_samples
+            samples.extend(aggregate_samples.get(
+                    (run.id, test_id), []))
+
+        # For now, return simplified sample set. We can return all the data if
+        # we find a use for it.
+        if status_samples or not samples:
+            return None
+        return min(samples)
+    data_table = {}
+    for subset_name,tests_in_subset in test_subsets.items():
+        data_table[subset_name] = subset_table = {}
+        for test_name in tests_in_subset:
+            subset_table[test_name] = test_data = [
+                [get_test_samples(id, test_name, order)
+                 for id in available_machine_ids]
+                for order in orders_to_aggregate]
+
+    # Create some other data tables of serializable info.
+    available_machine_info = [(m.id, m.name)
+                              for m in available_machines]
+
+    return render_template("simple_order_aggregate_report.html", **locals())





More information about the llvm-commits mailing list