[llvm-commits] [zorg] r146405 - in /zorg/trunk/lnt/lnt: db/ server/ui/ server/ui/static/ util/ viewer/ viewer/js/ viewer/resources/
Daniel Dunbar
daniel at zuster.org
Mon Dec 12 11:31:40 PST 2011
Author: ddunbar
Date: Mon Dec 12 13:31:40 2011
New Revision: 146405
URL: http://llvm.org/viewvc/llvm-project?rev=146405&view=rev
Log:
lnt.viewer: Continue removing Quixote based UI.
- Move viewer.{GraphUtil,Util} into server.ui.
Added:
zorg/trunk/lnt/lnt/server/ui/graphutil.py
- copied, changed from r146404, zorg/trunk/lnt/lnt/viewer/GraphUtil.py
zorg/trunk/lnt/lnt/server/ui/static/View2DTest.html
- copied, changed from r146404, zorg/trunk/lnt/lnt/viewer/js/View2DTest.html
zorg/trunk/lnt/lnt/server/ui/util.py
- copied, changed from r146404, zorg/trunk/lnt/lnt/viewer/Util.py
zorg/trunk/lnt/lnt/util/NTUtil.py
- copied, changed from r146404, zorg/trunk/lnt/lnt/viewer/NTUtil.py
Removed:
zorg/trunk/lnt/lnt/viewer/GraphUtil.py
zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl
zorg/trunk/lnt/lnt/viewer/NTUtil.py
zorg/trunk/lnt/lnt/viewer/Util.py
zorg/trunk/lnt/lnt/viewer/__init__.py
zorg/trunk/lnt/lnt/viewer/js/View2D.js
zorg/trunk/lnt/lnt/viewer/js/View2DTest.html
zorg/trunk/lnt/lnt/viewer/machines.ptl
zorg/trunk/lnt/lnt/viewer/nightlytest.ptl
zorg/trunk/lnt/lnt/viewer/resources/form.css
zorg/trunk/lnt/lnt/viewer/resources/popup.js
zorg/trunk/lnt/lnt/viewer/resources/sorttable.js
zorg/trunk/lnt/lnt/viewer/resources/style.css
zorg/trunk/lnt/lnt/viewer/runs.ptl
zorg/trunk/lnt/lnt/viewer/tests.ptl
Modified:
zorg/trunk/lnt/lnt/db/runinfo.py
zorg/trunk/lnt/lnt/server/ui/filters.py
zorg/trunk/lnt/lnt/server/ui/views.py
zorg/trunk/lnt/lnt/util/NTEmailReport.py
Modified: zorg/trunk/lnt/lnt/db/runinfo.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/runinfo.py?rev=146405&r1=146404&r2=146405&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/db/runinfo.py (original)
+++ zorg/trunk/lnt/lnt/db/runinfo.py Mon Dec 12 13:31:40 2011
@@ -1,5 +1,5 @@
from lnt.util import stats
-from lnt.viewer import Util
+from lnt.server.ui import util
from lnt.db.perfdb import Sample
from lnt.testing import PASS, FAIL, XFAIL
@@ -90,7 +90,7 @@
self.db = db
self.test_suite_summary = test_suite_summary
- self.sample_map = Util.multidict()
+ self.sample_map = util.multidict()
self.loaded_samples = set()
def get_test_status_in_run(self, run_id, status_kind, test_name, pset):
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=146405&r1=146404&r2=146405&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/filters.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/filters.py Mon Dec 12 13:31:40 2011
@@ -1,5 +1,5 @@
import datetime
-from lnt.viewer.Util import PctCell
+from lnt.server.ui import util
def filter_asusertime(time):
# FIXME: Support alternate timezones?
@@ -7,7 +7,7 @@
return ts.strftime('%Y-%m-%d %H:%M:%S %Z PST')
def filter_aspctcell(value, *args, **kwargs):
- cell = PctCell(value, *args, **kwargs)
+ cell = util.PctCell(value, *args, **kwargs)
return cell.render()
def register(app):
Copied: zorg/trunk/lnt/lnt/server/ui/graphutil.py (from r146404, zorg/trunk/lnt/lnt/viewer/GraphUtil.py)
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/graphutil.py?p2=zorg/trunk/lnt/lnt/server/ui/graphutil.py&p1=zorg/trunk/lnt/lnt/viewer/GraphUtil.py&r1=146404&r2=146405&rev=146405&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/GraphUtil.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/graphutil.py Mon Dec 12 13:31:40 2011
@@ -2,8 +2,7 @@
Helper functions for graphing test results.
"""
-import Util
-
+from lnt.server.ui import util
from lnt.util import stats
from lnt.external.stats import stats as ext_stats
@@ -27,7 +26,7 @@
for run_id,test_id,value in samples:
d = samples_by_test_id.get(test_id)
if d is None:
- d = samples_by_test_id[test_id] = Util.multidict()
+ d = samples_by_test_id[test_id] = util.multidict()
run_key = run_summary.get_run_order(run_id)
if run_key is None:
continue
@@ -76,7 +75,7 @@
plot_js = ""
# Determine the base plot color.
- col = list(Util.makeDarkColor(float(index) / num_plots))
+ col = list(util.makeDarkColor(float(index) / num_plots))
# Add regression line, if requested.
if show_linear_regression:
Copied: zorg/trunk/lnt/lnt/server/ui/static/View2DTest.html (from r146404, zorg/trunk/lnt/lnt/viewer/js/View2DTest.html)
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/static/View2DTest.html?p2=zorg/trunk/lnt/lnt/server/ui/static/View2DTest.html&p1=zorg/trunk/lnt/lnt/viewer/js/View2DTest.html&r1=146404&r2=146405&rev=146405&view=diff
==============================================================================
(empty)
Copied: zorg/trunk/lnt/lnt/server/ui/util.py (from r146404, zorg/trunk/lnt/lnt/viewer/Util.py)
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/util.py?p2=zorg/trunk/lnt/lnt/server/ui/util.py&p1=zorg/trunk/lnt/lnt/viewer/Util.py&r1=146404&r2=146405&rev=146405&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/Util.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/util.py Mon Dec 12 13:31:40 2011
@@ -198,19 +198,10 @@
return '%.*f%%' % (self.precision, self.value*100)
def render(self):
- import quixote.html
r,g,b = [clamp(int(v*255), 0, 255)
for v in self.getColor()]
res = '<td bgcolor="#%02x%02x%02x">%s</td>' % (r,g,b, self.getValue())
- return quixote.html.htmltext(res)
-
-
-def addOtherFormValues(form):
- import quixote
- request = quixote.get_request()
- for name,value in request.form.items():
- if form.get_widget(name) is None:
- form.add(quixote.form.HiddenWidget, name, value=value)
+ return res
def sorted(l, *args, **kwargs):
l = list(l)
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=146405&r1=146404&r2=146405&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Mon Dec 12 13:31:40 2011
@@ -189,8 +189,8 @@
run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag)
# Compute the list of associated runs, grouped by order.
- from lnt.viewer import Util
- grouped_runs = Util.multidict(
+ from lnt.server.ui import util
+ grouped_runs = util.multidict(
(run_summary.get_run_order(run_id), run_id)
for run_id in run_summary.get_runs_on_machine(id))
@@ -341,8 +341,8 @@
@db_route("/simple/<tag>/<int:id>/graph")
def simple_graph(tag, id):
- from lnt.viewer import GraphUtil
- from lnt.viewer import Util
+ from lnt.server.ui import graphutil
+ from lnt.server.ui import util
db, run, run_summary, compare_to = get_simple_run_info(tag, id)
@@ -391,7 +391,7 @@
num_points = 0
plot_points = []
plots = ""
- plots_iter = GraphUtil.get_test_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)
@@ -411,8 +411,8 @@
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 = [(util.safediv(p1[1], p0[1]), p0, p1)
+ for p0,p1 in util.pairs(points)]
deltas.sort()
deltas.reverse()
plot_deltas.append(deltas[:20])
@@ -448,7 +448,7 @@
@db_route("/simple/<tag>/order_aggregate_report")
def simple_order_aggregate_report(tag):
- from lnt.viewer import Util
+ from lnt.server.ui import util
db = request.get_db()
@@ -465,7 +465,7 @@
# Collect the runs, aggregated by order and machine.
runs_to_summarize = []
- runs_by_machine_and_order = Util.multidict()
+ 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]:
@@ -486,7 +486,7 @@
r.id for r in runs_to_summarize))
# Create test subsets, by name.
- test_subsets = Util.multidict()
+ test_subsets = util.multidict()
for test_name in test_names:
if '.' in test_name:
subset = test_name.rsplit('.', 1)[1]
@@ -510,7 +510,7 @@
all_samples = list(all_samples)
# Aggregate samples for easy lookup.
- aggregate_samples = Util.multidict()
+ aggregate_samples = util.multidict()
for run_id, test_id, value in all_samples:
aggregate_samples[(run_id, test_id)] = value
Modified: zorg/trunk/lnt/lnt/util/NTEmailReport.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/util/NTEmailReport.py?rev=146405&r1=146404&r2=146405&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/util/NTEmailReport.py (original)
+++ zorg/trunk/lnt/lnt/util/NTEmailReport.py Mon Dec 12 13:31:40 2011
@@ -12,13 +12,12 @@
import urllib
import StringIO
-from lnt import viewer
from lnt.db import runinfo
from lnt.db import perfdbsummary
-from lnt.viewer import GraphUtil
-from lnt.viewer import Util
+from lnt.server.ui import graphutil
+from lnt.server.ui import util
from lnt.db import perfdb
-from lnt.viewer.NTUtil import *
+from lnt.util.NTUtil import *
from lnt.db.perfdb import Run, Sample
@@ -140,14 +139,14 @@
test_names = ts_summary.get_test_names_in_runs(db, interesting_runs)
# Gather the changes to report, mapped by parameter set.
- new_failures = Util.multidict()
- new_passes = Util.multidict()
- perf_regressions = Util.multidict()
- perf_improvements = Util.multidict()
- added_tests = Util.multidict()
- removed_tests = Util.multidict()
- existing_failures = Util.multidict()
- unchanged_tests = Util.multidict()
+ new_failures = util.multidict()
+ new_passes = util.multidict()
+ perf_regressions = util.multidict()
+ perf_improvements = util.multidict()
+ added_tests = util.multidict()
+ removed_tests = util.multidict()
+ existing_failures = util.multidict()
+ unchanged_tests = util.multidict()
num_total_tests = len(test_names) * len(ts_summary.parameter_sets)
for name in test_names:
for pset in ts_summary.parameter_sets:
@@ -328,11 +327,11 @@
if '.' in name:
return name.rsplit('.', 1)[1]
return ''
- grouped = Util.multidict(
+ grouped = util.multidict(
(get_last_component(t), t)
for t in tests)
- for group,grouped_tests in Util.sorted(grouped.items()):
+ for group,grouped_tests in util.sorted(grouped.items()):
group_name = {
"" : "(ungrouped)",
"exec" : "Execution",
@@ -384,7 +383,7 @@
os.path.join(report_url, "graph"),
form_data, name)
- pct_value = Util.PctCell(cr.pct_delta).render()
+ pct_value = util.PctCell(cr.pct_delta).render()
if cr.stddev is not None:
print >>html_report, """
<tr><td>%s%s</td>%s<td>%.4f</td><td>%.4f</td><td>%.4f</td></tr>""" %(
@@ -408,7 +407,7 @@
test_ids = [ts_summary.test_id_map[(name,pset)]
for _,name,pset in graphs]
- plots_iter = GraphUtil.get_test_plots(db, machine, test_ids,
+ plots_iter = graphutil.get_test_plots(db, machine, test_ids,
run_summary, ts_summary,
show_mad_error = True,
show_points = True)
@@ -433,16 +432,16 @@
if not only_html_body:
# We embed the additional resources, so that the message is self
# contained.
- viewer_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
- "viewer")
- style_css = open(os.path.join(viewer_path, "resources",
+ static_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
+ "server", "ui", "static")
+ style_css = open(os.path.join(static_path,
"style.css")).read()
header = """
<style type="text/css">
%s
</style>""" % style_css
if graphs:
- view2d_js = open(os.path.join(viewer_path, "js",
+ view2d_js = open(os.path.join(static_path,
"View2D.js")).read()
header += """
<script type="text/javascript">
@@ -474,7 +473,7 @@
compareTo = None
# Find comparison run.
- # FIXME: Share this code with similar stuff in the viewer.
+ # FIXME: Share this code with similar stuff in the server UI.
# FIXME: Scalability.
compareCrossesMachine = False
compareTo = findPreceedingRun(db.runs(machine=machine), run)
@@ -508,13 +507,13 @@
return res
return not not res
- newPasses = Util.multidict()
- newFailures = Util.multidict()
- addedTests = Util.multidict()
- removedTests = Util.multidict()
+ newPasses = util.multidict()
+ newFailures = util.multidict()
+ addedTests = util.multidict()
+ removedTests = util.multidict()
allTests = set()
allFailures = set()
- allFailuresByKey = Util.multidict()
+ allFailuresByKey = util.multidict()
for keyname,title in kTSKeys.items():
for testname in summary.testNames:
curResult = getTestSuccess(run, testname, keyname)
@@ -540,7 +539,7 @@
if curResult is None and prevResult is not None:
removedTests[testname] = title
- changes = Util.multidict()
+ changes = util.multidict()
for i,(name,key) in enumerate(kComparisonKinds):
if not key:
# FIXME: File Size
@@ -554,7 +553,7 @@
if curValue is None or prevValue is None:
continue
- pct = Util.safediv(curValue, prevValue)
+ pct = util.safediv(curValue, prevValue)
if pct is None:
continue
pctDelta = pct - 1.
@@ -615,7 +614,7 @@
print >>report, """Total Test Failures: %d""" % (len(allFailures),)
print >>report
print >>report, """Total Test Failures By Type:"""
- for name,items in Util.sorted(allFailuresByKey.items()):
+ for name,items in util.sorted(allFailuresByKey.items()):
print >>report, """ %s: %d""" % (name, len(set(items)))
print >>report
@@ -626,11 +625,11 @@
('Removed Tests', removedTests)):
print >>report, """%s:""" % (title,)
print >>report, "".join("%s [%s]\n" % (key, ", ".join(values))
- for key,values in Util.sorted(elts.items()))
+ for key,values in util.sorted(elts.items()))
print >>report, """Significant Changes in Test Results:"""
for name,changelist in changes.items():
print >>report, """%s:""" % name
- for name,curValue,prevValue,delta in Util.sorted(changelist):
+ for name,curValue,prevValue,delta in util.sorted(changelist):
print >>report, """ %s: %.2f%% (%.4f => %.4f)""" % (
name, delta*100, prevValue, curValue)
Copied: zorg/trunk/lnt/lnt/util/NTUtil.py (from r146404, zorg/trunk/lnt/lnt/viewer/NTUtil.py)
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/util/NTUtil.py?p2=zorg/trunk/lnt/lnt/util/NTUtil.py&p1=zorg/trunk/lnt/lnt/viewer/NTUtil.py&r1=146404&r2=146405&rev=146405&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/NTUtil.py (original)
+++ zorg/trunk/lnt/lnt/util/NTUtil.py Mon Dec 12 13:31:40 2011
@@ -1,4 +1,4 @@
-import Util
+from lnt.server.ui import util
from lnt.db.perfdb import Run, Sample, Test
kPrefix = 'nightlytest'
@@ -76,7 +76,7 @@
def addRun(self, db, run, testPredicate=None, infoPredicates=None):
sampleMap = self.runSamples.get(run.id)
if sampleMap is None:
- sampleMap = self.runSamples[run.id] = Util.multidict()
+ sampleMap = self.runSamples[run.id] = util.multidict()
q = db.session.query(Sample.value,Test).join(Test)
q = q.filter(Sample.run == run)
Removed: zorg/trunk/lnt/lnt/viewer/GraphUtil.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/GraphUtil.py?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/GraphUtil.py (original)
+++ zorg/trunk/lnt/lnt/viewer/GraphUtil.py (removed)
@@ -1,132 +0,0 @@
-"""
-Helper functions for graphing test results.
-"""
-
-import Util
-
-from lnt.util import stats
-from lnt.external.stats import stats as ext_stats
-
-from lnt.db.perfdb import Machine, Run, RunInfo, Sample, Test
-
-def get_test_plots(db, machine, test_ids, run_summary, ts_summary,
- show_mad_error = False, show_points = False,
- show_all_points = False, show_stddev = False,
- show_linear_regression = False):
- # Load all the samples for these tests and this machine.
- q = db.session.query(Sample.run_id,Sample.test_id,
- Sample.value).join(Run)
- q = q.filter(Run.machine_id == machine.id)
- q = q.filter(Sample.test_id.in_(test_ids))
- samples = list(q)
-
- # Aggregate by test id and then run key.
- #
- # FIXME: Pretty expensive.
- samples_by_test_id = {}
- for run_id,test_id,value in samples:
- d = samples_by_test_id.get(test_id)
- if d is None:
- d = samples_by_test_id[test_id] = Util.multidict()
- run_key = run_summary.get_run_order(run_id)
- if run_key is None:
- continue
-
- # FIXME: What to do on failure?
- run_key = int(run_key)
- d[run_key] = value
-
- # Build the graph data
- pset_id_map = dict([(pset,i)
- for i,pset in enumerate(ts_summary.parameter_sets)])
- num_plots = len(test_ids)
- for index,test_id in enumerate(test_ids):
- test = db.getTest(test_id)
- pset = test.get_parameter_set()
- name = test.name
-
- # Get the plot for this test.
- #
- # FIXME: Support order by something other than time.
- errorbar_data = []
- points_data = []
- data = []
- points = []
- for x,values in samples_by_test_id.get(test_id,{}).items():
- min_value = min(values)
- data.append((x, min_value))
- if show_points:
- if show_all_points:
- for v in values:
- points_data.append((x, v))
- else:
- points_data.append((x, min_value))
- if show_stddev:
- mean = stats.mean(values)
- sigma = stats.standard_deviation(values)
- errorbar_data.append((x, mean - sigma, mean + sigma))
- if show_mad_error:
- med = stats.median(values)
- mad = stats.median_absolute_deviation(values, med)
- errorbar_data.append((x, med - mad, med + mad))
- points.append((x, min_value, mad, med))
- data.sort()
- points.sort()
-
- plot_js = ""
-
- # Determine the base plot color.
- col = list(Util.makeDarkColor(float(index) / num_plots))
-
- # Add regression line, if requested.
- if show_linear_regression:
- xs = [t for t,v in data]
- ys = [v for t,v in data]
-
- # We compute the regression line in terms of a normalized X scale.
- x_min, x_max = min(xs), max(xs)
- try:
- norm_xs = [(x - x_min) / (x_max - x_min)
- for x in xs]
- except ZeroDivisionError:
- norm_xs = xs
-
- try:
- info = ext_stats.linregress(norm_xs, ys)
- except ZeroDivisionError:
- info = None
- except ValueError:
- info = None
-
- if info is not None:
- slope, intercept,_,_,_ = info
-
- reglin_col = [c*.5 for c in col]
- pts = ','.join('[%.4f,%.4f]' % pt
- for pt in [(x_min, 0.0 * slope + intercept),
- (x_max, 1.0 * slope + intercept)])
- style = "new Graph2D_LinePlotStyle(4, %r)" % ([.7, .7, .7],)
- plot_js += " graph.addPlot([%s], %s);\n" % (pts,style)
- style = "new Graph2D_LinePlotStyle(2, %r)" % (reglin_col,)
- plot_js += " graph.addPlot([%s], %s);\n" % (pts,style)
-
- pts = ','.join(['[%.4f,%.4f]' % (t,v)
- for t,v in data])
- style = "new Graph2D_LinePlotStyle(1, %r)" % col
- plot_js += " graph.addPlot([%s], %s);\n" % (pts,style)
-
- if points_data:
- pts_col = (0,0,0)
- pts = ','.join(['[%.4f,%.4f]' % (t,v)
- for t,v in points_data])
- style = "new Graph2D_PointPlotStyle(1, %r)" % (pts_col,)
- plot_js += " graph.addPlot([%s], %s);\n" % (pts,style)
-
- if errorbar_data:
- bar_col = [c*.7 for c in col]
- pts = ','.join(['[%.4f,%.4f,%.4f]' % (x,y_min,y_max)
- for x,y_min,y_max in errorbar_data])
- style = "new Graph2D_ErrorBarPlotStyle(1, %r)" % (bar_col,)
- plot_js += " graph.addPlot([%s], %s);\n" % (pts,style)
-
- yield (test_id, plot_js, col, data, points)
Removed: zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl (removed)
@@ -1,621 +0,0 @@
-# -*- python -*-
-
-"""
-Base UI object for implementing an LNT "nightlytest" style browser of test
-results.
-
-This relies on naming conventions amongst the tests to infer the structure, and
-provide a GUI similar to the old nightly test infrastructure.
-"""
-
-import re
-
-import quixote
-from quixote.directory import Directory
-from quixote.errors import TraversalError
-
-import Util
-from lnt.db.NTUtil import *
-
-from lnt.db.perfdb import Machine, Run, RunInfo
-
-class TestRunUI(Directory):
- def __init__(self, root, idstr):
- self.root = root
- try:
- self.id = int(idstr)
- except ValueError, exc:
- raise TraversalError(str(exc))
-
- def getActiveRun(self, db):
- # Check for overrides.
- #
- # FIXME: This is broken, and breaks down in places. We need to redirect
- # properly.
- request = quixote.get_request()
- id = self.id
- run_id = request.form.get('run', '')
- if run_id:
- id = int(run_id)
- return db.getRun(id)
-
- def getInfo(self, db):
- request = quixote.get_request()
-
- compareToID = request.form.get('compare', '')
- compareTo = None
- if compareToID:
- try:
- compareTo = db.getRun(int(compareToID))
- except:
- pass
-
- run = self.getActiveRun(db)
-
- # Find previous runs, ordered by time.
- runs = db.runs(run.machine).order_by(Run.start_time.desc()).all()
-
- # Order by run_order info key, if given.
- for r in runs:
- if 'run_order' in r.info:
- has_order = True
- break
- else:
- has_order = False
- if has_order:
- runs.sort(key = lambda r: ('run_order' in r.info and
- r.info['run_order'].value))
- runs.reverse()
-
- # Find previous run to compare to.
- if compareTo is None:
- for r in runs:
- # FIXME: Compare revisions, not times.
- if r != run and r.start_time < run.start_time:
- compareTo = r
- break
-
- return run, runs, compareTo
-
- def getRunSummary(self, db, run, compareTo, form=None):
- testPredicate = None
- infoPredicates = []
- if form:
- testPattern = form['testPattern']
- if testPattern and testPattern.strip():
- testPattern = re.compile(testPattern)
- testPredicate = lambda t: testPattern.search(t.name)
- parameters = self.getParameters()
- for i,(title,name) in enumerate(self.getParameters()):
- pattern = form['parmPattern.%d' % i]
- if pattern and pattern.strip():
- pattern = re.compile(pattern)
- infoPredicates.append((name,
- lambda t,k,v,p=pattern: p.search(v)))
-
- # Compare the summary information.
- summary = RunSummary()
- summary.addRun(db, run, testPredicate, infoPredicates)
- if compareTo:
- summary.addRun(db, compareTo, testPredicate, infoPredicates)
- return summary
-
- def _q_index [html] (self):
- # Get a DB connection.
- db = self.root.getDB()
-
- # Get the filtering form.
- form = quixote.form.Form(method=str("get"))
- form.add(quixote.form.StringWidget, "testPattern",
- title="Test Pattern")
- for i,(title,name) in enumerate(self.getParameters()):
- form.add(quixote.form.StringWidget, "parmPattern.%d" %i,
- title="Parameter Pattern: %s" % title)
- form.add_submit("submit", "Update")
- Util.addOtherFormValues(form)
-
- run,runs,compareTo = self.getInfo(db)
- machine = run.machine
- summary = self.getRunSummary(db, run, compareTo, form)
-
- self.root.getHeader('Run Results', "../..",
- components=(('nightlytest','nightlytest'),
- ('machine',
- 'nightlytest/machines/%d'%machine.id)),
- addPopupJS=True, addFormCSS=True)
-
- request = quixote.get_request()
- full = request.form.get('full', '')
- allResults = not not full
-
- """
- <center>
- <table>
- <tr>
- <td align=right>Machine:</td>
- <td>%s:%d</td>
- </tr>
- <tr>
- <td align=right>Run:</td>
- <td>%s</td>
- </tr>
- """ % (machine.name, machine.number, run.start_time)
- if compareTo:
- """
- <tr>
- <td align=right>Compare To:</td>
- <td>%s</td>
- </tr>
- """ % (compareTo.start_time,)
- """
- </table>
- </center>
- <p>
- """
-
- # Show filtering options, hidden by default unless filled in.
- hidden = True
- for w in form.get_all_widgets():
- if isinstance(w, (quixote.form.HiddenWidget,)):
- continue
- value = w.value
- if value:
- hidden = False
- break
- key = 'filteringOptions'
- """
- <a href="javascript://" onclick="toggleLayer('%s')"; id="%s_">(%s)
- Show Filtering Options</a>
- <div id="%s" style="display: %s;" class="hideable">
- """ % (key, key, ("+","-")[hidden], key, ("","none")[hidden])
- form.render()
- """
- </div>
- <p>
- """
-
- """
- <table width="100%%" border=1>
- <tr>
- <td valign="top" width="200">
- <a href="..">Homepage</a>
- <h4>Machine:</h4>
- <a href="../machines/%d/">%s:%d</a>
- <h4>Runs:</h4>
- <ul>
- """ % (machine.id, machine.name, machine.number)
-
- # Show a small number of neighboring runs.
- runIndex = runs.index(run)
- for r in runs[max(0,runIndex-3):runIndex+6]:
- if r == run:
- """ <li> <h3><a href="../%d/">%s</a></h3> """ % (r.id,
- r.start_time)
- else:
- """ <li> <a href="../%d/">%s</a> """ % (r.id, r.start_time)
-
- # Full list of runs in a drop down.
- #
- # FIXME: Make this link to the proper run.
- """
- <p>
- <form method="GET" action=".">
- <input type="hidden" name="full" value="%s">
- <select name="run">
- """ % (full,)
- for r in runs:
- """\
- <option value="%d"%s>%s""" % (r.id, ('', ' selected')[r == run],
- r.start_time)
-
- """
- </select>
- <input type="submit" value="Jump to Run">
- </form>
- """
- # Set comparison run.
- """
- <form method="GET" action=".">
- <input type="hidden" name="full" value="%s">
- <select name="compare">
- """ % (full,)
- for r in runs:
- selected = ('', ' selected')[r == compareTo]
- """\
- <option value="%d"%s>%s</option>""" % (r.id, selected, r.start_time)
-
- """
- </select>
- <input type="submit" value="Compare to Run">
- </form>
- """
-
- """
- </ul>
- </td>
- <td valign="top">
- <table border=1>
- <tr>
- <td> <b>Nickname</b> </td>
- <td> %s </td>
- </tr>
- <tr>
- <td> <b>Machine ID</b> </td>
- <td> %d </td>
- </tr>
- </table>""" % (machine.name, machine.id)
- self.renderPopupBegin('machine_info', 'Machine Info', True)
- """
- <table border=1>"""
- info = machine.info.values()
- info.sort(key = lambda i: i.key)
- for mi in info:
- """
- <tr>
- <td> <b>%s</b> </td>
- <td>%s</td>
- </tr>
- """ % (mi.key, mi.value)
- """
- </table>"""
- self.renderPopupEnd()
-
- self.renderPopupBegin('run_info', 'Run Info', True)
- """
- <table border=1>"""
- info = run.info.values()
- info.sort(key = lambda i: i.key)
- for ri in info:
- """
- <tr>
- <td> <b>%s</b> </td>
- <td>%s</td>
- </tr>
- """ % (ri.key, ri.value)
- """
- </table>"""
- self.renderPopupEnd()
-
- if allResults:
- """<h4><a href="?full=">See Brief Test Results</a></h4>"""
- else:
- """<h4><a href="?full=1">See Full Test Results</a></h4>"""
-
- self.renderCommonContents(db, run, compareTo, summary)
- if not allResults:
- self.renderBriefContents(db, run, compareTo, summary)
-
- """
- </td>
- </tr>
- </table>
- """
-
- if allResults:
- self.renderFullContents(db, run, compareTo, summary)
-
- self.root.getFooter()
-
- ###
-
- def getTags(self):
- abstract
-
- def getParameters(self):
- abstract
-
- def renderFullContents(self, db, run, compareTo, summary):
- abstract
-
- def renderBriefContents(self, db, run, compareTo, summary):
- abstract
-
- def renderCommonContents(self, db, run, compareTo, summary):
- abstract
-
-class MachineUI(Directory):
- _q_exports = [""]
-
- def __init__(self, root, parent, idstr):
- self.root = root
- self.parent = parent
- try:
- self.id = int(idstr)
- except ValueError, exc:
- raise TraversalError(str(exc))
- self.popupDepth = 0
-
- def renderPopupBegin [html] (self, id, title, hidden):
- self.popupDepth += 1
- """\
- <p>
- <a href="javascript://" onclick="toggleLayer('%s')"; id="%s_">(%s) %s</a>
- <div id="%s" style="display: %s;" class="hideable_%d">
- """ % (id, id, ("+","-")[hidden], title, id, ("","none")[hidden],
- self.popupDepth)
-
- def renderPopupEnd [html] (self):
- """
- </div>"""
- self.popupDepth -= 1
-
- def _q_index [html] (self):
- # Get a DB connection.
- db = self.root.getDB()
-
- machine = db.getMachine(self.id)
-
- self.root.getHeader("Machine: %s:%d" % (machine.name,machine.number),
- "%s/../.." % self.parent.root_path,
- components=self.parent.components,
- addPopupJS=True)
-
- # Find all runs on this machine.
- runs = db.runs(machine).order_by(Run.start_time.desc()).all()
-
- # Order by run_order info key, if given.
- for r in runs:
- if 'run_order' in r.info:
- has_order = True
- break
- else:
- has_order = False
- if has_order:
- runs.sort(key = lambda r: ('run_order' in r.info and
- r.info['run_order'].value))
- runs.reverse()
-
- # FIXME: List previous machines with the same nickname?
- """
- <table width="100%%" border=1>
- <tr>
- <td valign="top" width="200">
- <a href="../..">Homepage</a>
- <h4>Relatives:</h4>
- <ul>
- """
- # List all machines with this name.
- for m in db.machines(name=machine.name):
- """<li><a href="../%d">%s:%d</a></li>""" % (m.id, m.name, m.number)
- """
- </ul>
- <h4>Runs:</h4>
- <ul>
- """
-
- # Show the most recent 10 runs.
- for r in runs[:10]:
- """ <li> <a href="../../%d/">%s</a> """ % (r.id, r.start_time)
-
- # Full list of runs in a drop down.
- #
- # FIXME: Link to run correctly.
- """
- <p>
- <form method="GET" action="../../1/">
- <select name="run">
- """
- for r in runs:
- """\
- <option value="%d">%s""" % (r.id, r.start_time)
-
- """
- </select>
- <input type="submit" value="Go to Run">
- </form>
- """
-
- """
- </ul>
- </td>
- <td valign="top">
- <table border=1>
- <tr>
- <td> <b>Nickname</b> </td>
- <td> %s </td>
- </tr>
- <tr>
- <td> <b>Machine ID</b> </td>
- <td> %d </td>
- </tr>
- </table>""" % (machine.name, machine.id)
- self.renderPopupBegin('machine_info', 'Machine Info', True)
- """
- <table border=1>"""
- info = machine.info.values()
- info.sort(key = lambda i: i.key)
- for mi in info:
- """
- <tr>
- <td> <b>%s</b> </td>
- <td>%s</td>
- </tr>""" % (mi.key, mi.value)
- """
- </table>"""
- self.renderPopupEnd()
-
- # List associated runs.
-
- """
- <p>
- <table class="sortable" border=1>
- <thead>
- <tr>"""
- if has_order:
- """
- <th>Run Order</th>"""
- """
- <th>Start Time</th>
- <th>End Time</th>
- <th> </th>
- </thead>
- """
- for r in runs:
- """
- <tr>"""
- if has_order:
- if 'run_order' in r.info:
- order_value = r.info['run_order'].value
- else:
- order_value = str(' ')
- """
- <td align=right>%s</td>""" % order_value
- """
- <td>%s</td>
- <td>%s</td>
- <td><a href="../../%d">View Results</a></td>
- </tr>""" % (r.start_time, r.end_time, r.id)
- """
- </table>
- """
-
- """
- </td>
- </tr>
- </table>
- """
-
- self.root.getFooter()
-
-class MachinesDirectory(Directory):
- _q_exports = [""]
-
- def __init__(self, parent):
- Directory.__init__(self)
- self.parent = parent
-
- def _q_index [plain] (self):
- """
- machine access
- """
-
- def _q_lookup(self, component):
- return MachineUI(self.parent.root, self.parent, component)
-
-class ProgramsDirectory(Directory):
- _q_exports = [""]
-
- def __init__(self, parent):
- Directory.__init__(self)
- self.parent = parent
-
- def _q_index [plain] (self):
- """
- program access
- """
-
- def _q_lookup(self, component):
- return self.parent.getProgramUI(component)
-
-class RecentMachineDirectory(Directory):
- def __init__(self, root):
- Directory.__init__(self)
- self.root = root
- self.root_path = '..'
- self.components = (('nightlytest','nightlytest'),)
-
- def getTags(self):
- abstract
-
- def _q_index [plain] (self):
- # Get a DB connection
- db = self.root.getDB()
-
- self.root.getHeader('Overview', self.root_path, self.components)
-
- # Find recent runs.
- """
- <center><h3>Submission Overview</h3></center>
- <table width="100%%">
- <tr>
- <td valign="top" width="50%">
- <center>
- <h3>Test Machines</h3>
- <table class="sortable" border=1>
- <thead>
- <tr>
- <th>Latest Submission</th>
- <th>Machine</th>
- <th>Results</th>
- </tr>
- </thead>
- """
-
- # Show the most recent entry for each machine.
- q = db.session.query(Machine.name).distinct().order_by(Machine.name)
- for name, in q:
- # Get the most recent run for this machine name.
- q = db.session.query(Run).join(Machine).filter(Machine.name == name)
- r = q.order_by(Run.start_time.desc()).first()
-
- # Limit by matching tags.
- if 'tag' in r.info:
- tag = r.info['tag'].value
- else:
- tag = None
- if tag not in self.getTags():
- continue
-
- """
- <tr>
- <td>%s</td>
- <td align=left><a href="machines/%d/">%s:%d</a></td>
- <td><a href="%d/">View Results</a></td>
- </tr>
- """ % (r.start_time, r.machine.id, r.machine.name,
- r.machine.number, r.id)
-
- """
- </table>
- </center>
- </td>
- <td valign="top">
- <center>
- <h3>Recent Submissions</h3>
- <table class="sortable" border=1>
- <thead>
- <tr>
- <th>Start Time</th>
- <th>End Time</th>
- <th>Machine</th>
- <th>Results</th>
- </tr>
- </thead>
- """
-
- # Show the 20 most recent submissions, ordered by time.
- for r in db.session.query(Run).order_by(Run.start_time.desc())[:20]:
- # Limit by matching tags.
- if 'tag' in r.info:
- tag = r.info['tag'].value
- else:
- tag = None
- if tag not in self.getTags():
- continue
-
- m = r.machine
- """
- <tr>
- <td>%s</td>
- <td>%s</td>
- <td align=left><a href="machines/%d/">%s:%d</a></td>
- <td><a href="%d/">View Results</a></td>
- </tr>
- """ % (r.start_time, r.end_time, m.id, m.name, m.number, r.id)
-
- """
- </table>
- </center>
- </td>
- </tr>
- </table>
- """
-
- self.root.getFooter()
-
- def _q_lookup(self, component):
- if component == 'machines':
- return MachinesDirectory(self)
- if component == 'programs':
- return ProgramsDirectory(self)
- return self.getTestRunUI(component)
Removed: zorg/trunk/lnt/lnt/viewer/NTUtil.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/NTUtil.py?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/NTUtil.py (original)
+++ zorg/trunk/lnt/lnt/viewer/NTUtil.py (removed)
@@ -1,113 +0,0 @@
-import Util
-from lnt.db.perfdb import Run, Sample, Test
-
-kPrefix = 'nightlytest'
-
-# FIXME: We shouldn't need this.
-kSentinelKeyName = 'bc.compile.success'
-
-kComparisonKinds = [('File Size',None),
- ('CBE','cbe.exec.time'),
- ('LLC','llc.exec.time'),
- ('JIT','jit.exec.time'),
- ('GCCAS','gcc.compile.time'),
- ('Bitcode','bc.compile.size'),
- ('LLC compile','llc.compile.time'),
- ('LLC-BETA compile','llc-beta.compile.time'),
- ('JIT codegen','jit.compile.time'),
- ('LLC-BETA','llc-beta.exec.time')]
-
-kTSKeys = { 'gcc.compile' : 'GCCAS',
- 'bc.compile' : 'Bitcode',
- 'llc.compile' : 'LLC compile',
- 'llc-beta.compile' : 'LLC_BETA compile',
- 'jit.compile' : 'JIT codegen',
- 'cbe.exec' : 'CBE',
- 'llc.exec' : 'LLC',
- 'llc-beta.exec' : 'LLC-BETA',
- 'jit.exec' : 'JIT' }
-
-# This isn't very fast, compute a summary if querying the same run
-# repeatedly.
-def getTestValueInRun(db, r, t, default=None, coerce=None):
- for value, in db.session.query(Sample.value).\
- filter(Sample.test == t).\
- filter(Sample.run == r):
- if coerce is not None:
- return coerce(value)
- return value
- return default
-
-def getTestNameValueInRun(db, r, testname, default=None, coerce=None):
- for value, in db.session.query(Sample.value).join(Test).\
- filter(Test.name == testname).\
- filter(Sample.run == r):
- if coerce is not None:
- return coerce(value)
- return value
- return default
-
-class RunSummary:
- def __init__(self):
- # The union of test names seen.
- self.testNames = set()
- # Map of test ids to test instances.
- self.testIds = {}
- # Map of test names to test instances
- self.testMap = {}
- # Map of run to multimap of test ID to sample list.
- self.runSamples = {}
-
- # FIXME: Should we worry about the info parameters on a
- # nightlytest test?
-
- def testMatchesPredicates(self, db, t, testPredicate, infoPredicates):
- if testPredicate:
- if not testPredicate(t):
- return False
- if infoPredicates:
- info = dict((i.key,i.value) for i in t.info.values())
- for key,predicate in infoPredicates:
- value = info.get(key)
- if not predicate(t, key, value):
- return False
- return True
-
- def addRun(self, db, run, testPredicate=None, infoPredicates=None):
- sampleMap = self.runSamples.get(run.id)
- if sampleMap is None:
- sampleMap = self.runSamples[run.id] = Util.multidict()
-
- q = db.session.query(Sample.value,Test).join(Test)
- q = q.filter(Sample.run == run)
- for s_value,t in q:
- if not self.testMatchesPredicates(db, t, testPredicate, infoPredicates):
- continue
-
- sampleMap[t.id] = s_value
- self.testMap[t.name] = t
- self.testIds[t.id] = t
-
- # Filter out summary things in name lists by only looking
- # for things which have a .success entry.
- if t.name.endswith('.success'):
- self.testNames.add(t.name.split('.', 3)[1])
-
- def getRunSamples(self, run):
- if run is None:
- return {}
- return self.runSamples.get(run.id, {})
-
- def getTestValueByName(self, run, testName, default, coerce=None):
- t = self.testMap.get(testName)
- if t is None:
- return default
- sampleMap = self.runSamples.get(run.id, {})
- samples = sampleMap.get(t.id)
- if sampleMap is None or samples is None:
- return default
- # FIXME: Multiple samples?
- if coerce:
- return coerce(samples[0].value)
- else:
- return samples[0].value
Removed: zorg/trunk/lnt/lnt/viewer/Util.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/Util.py?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/Util.py (original)
+++ zorg/trunk/lnt/lnt/viewer/Util.py (removed)
@@ -1,218 +0,0 @@
-import colorsys
-import math
-
-def detectCPUs():
- """
- Detects the number of CPUs on a system. Cribbed from pp.
- """
- import os
- # Linux, Unix and MacOS:
- if hasattr(os, "sysconf"):
- if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"):
- # Linux & Unix:
- ncpus = os.sysconf("SC_NPROCESSORS_ONLN")
- if isinstance(ncpus, int) and ncpus > 0:
- return ncpus
- else: # OSX:
- return int(os.popen2("sysctl -n hw.ncpu")[1].read())
- # Windows:
- if os.environ.has_key("NUMBER_OF_PROCESSORS"):
- ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]);
- if ncpus > 0:
- return ncpus
- return 1 # Default
-
-def pairs(list):
- return zip(list[:-1],list[1:])
-
-def safediv(a, b, default=None):
- try:
- return a/b
- except ZeroDivisionError:
- return default
-
-def makeDarkColor(h):
- h = h%1.
- s = 0.95
- v = 0.8
- return colorsys.hsv_to_rgb(h,0.9+s*.1,v)
-
-def makeMediumColor(h):
- h = h%1.
- s = .68
- v = 0.92
- return colorsys.hsv_to_rgb(h,s,v)
-
-def makeLightColor(h):
- h = h%1.
- s = (0.5,0.4)[h>0.5 and h<0.8]
- v = 1.0
- return colorsys.hsv_to_rgb(h,s,v)
-
-def makeBetterColor(h):
- h = math.cos(h*math.pi*.5)
- s = .8 + ((math.cos(h * math.pi*.5) + 1)*.5) * .2
- v = .88
- return colorsys.hsv_to_rgb(h,s,v)
-
-class multidict:
- def __init__(self, elts=()):
- self.data = {}
- for key,value in elts:
- self[key] = value
-
- def __contains__(self, item):
- return item in self.data
- def __getitem__(self, item):
- return self.data[item]
- def __setitem__(self, key, value):
- if key in self.data:
- self.data[key].append(value)
- else:
- self.data[key] = [value]
- def items(self):
- return self.data.items()
- def values(self):
- return self.data.values()
- def keys(self):
- return self.data.keys()
- def __len__(self):
- return len(self.data)
- def get(self, key, default=None):
- return self.data.get(key, default)
-
-def any_true(list, predicate):
- for i in list:
- if predicate(i):
- return True
- return False
-
-def any_false(list, predicate):
- return any_true(list, lambda x: not predicate(x))
-
-def all_true(list, predicate):
- return not any_false(list, predicate)
-
-def all_false(list, predicate):
- return not any_true(list, predicate)
-
-def geometric_mean(l):
- iPow = 1./len(l)
- return reduce(lambda a,b: a*b, [v**iPow for v in l])
-
-def mean(l):
- return sum(l) / len(l)
-
-def median(l):
- l = list(l)
- l.sort()
- N = len(l)
- return (l[(N - 1)//2] +
- l[(N + 0)//2]) * .5
-
-def prependLines(prependStr, str):
- return ('\n'+prependStr).join(str.splitlines())
-
-def pprint(object, useRepr=True):
- def recur(ob):
- return pprint(ob, useRepr)
- def wrapString(prefix, string, suffix):
- return '%s%s%s' % (prefix,
- prependLines(' ' * len(prefix),
- string),
- suffix)
- def pprintArgs(name, args):
- return wrapString(name + '(', ',\n'.join(map(recur,args)), ')')
-
- if isinstance(object, tuple):
- return wrapString('(', ',\n'.join(map(recur,object)),
- [')',',)'][len(object) == 1])
- elif isinstance(object, list):
- return wrapString('[', ',\n'.join(map(recur,object)), ']')
- elif isinstance(object, set):
- return pprintArgs('set', list(object))
- elif isinstance(object, dict):
- elts = []
- for k,v in object.items():
- kr = recur(k)
- vr = recur(v)
- elts.append('%s : %s' % (kr,
- prependLines(' ' * (3 + len(kr.splitlines()[-1])),
- vr)))
- return wrapString('{', ',\n'.join(elts), '}')
- else:
- if useRepr:
- return repr(object)
- return str(object)
-
-def prefixAndPPrint(prefix, object, useRepr=True):
- return prefix + prependLines(' '*len(prefix), pprint(object, useRepr))
-
-def clamp(v, minVal, maxVal):
- return min(max(v, minVal), maxVal)
-
-def lerp(a,b,t):
- t_ = 1. - t
- return tuple([av*t_ + bv*t for av,bv in zip(a,b)])
-
-class PctCell:
- # Color levels
- kNeutralColor = (1,1,1)
- kNegativeColor = (0,1,0)
- kPositiveColor = (1,0,0)
- # Invalid color
- kNANColor = (.86,.86,.86)
- kInvalidColor = (0,0,1)
-
- def __init__(self, value, reverse=False, precision=2, delta=False):
- if delta and isinstance(value, float):
- value -= 1
- self.value = value
- self.reverse = reverse
- self.precision = precision
-
- def getColor(self):
- v = self.value
- if not isinstance(v, float):
- return self.kNANColor
-
- # Clamp value.
- v = clamp(v, -1, 1)
-
- if self.reverse:
- v = -v
- if v < 0:
- c = self.kNegativeColor
- else:
- c = self.kPositiveColor
- t = abs(v)
-
- # Smooth mapping to put first 20% of change into 50% of range, although
- # really we should compensate for luma.
- t = math.sin((t ** .477) * math.pi * .5)
- return lerp(self.kNeutralColor, c, t)
-
- def getValue(self):
- if not isinstance(self.value, float):
- return self.value
- return '%.*f%%' % (self.precision, self.value*100)
-
- def render(self):
- import quixote.html
- r,g,b = [clamp(int(v*255), 0, 255)
- for v in self.getColor()]
- res = '<td bgcolor="#%02x%02x%02x">%s</td>' % (r,g,b, self.getValue())
- return quixote.html.htmltext(res)
-
-
-def addOtherFormValues(form):
- import quixote
- request = quixote.get_request()
- for name,value in request.form.items():
- if form.get_widget(name) is None:
- form.add(quixote.form.HiddenWidget, name, value=value)
-
-def sorted(l, *args, **kwargs):
- l = list(l)
- l.sort(*args, **kwargs)
- return l
Removed: zorg/trunk/lnt/lnt/viewer/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/__init__.py?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/__init__.py (original)
+++ zorg/trunk/lnt/lnt/viewer/__init__.py (removed)
@@ -1 +0,0 @@
-__all__ = []
Removed: zorg/trunk/lnt/lnt/viewer/js/View2D.js
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/js/View2D.js?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/js/View2D.js (original)
+++ zorg/trunk/lnt/lnt/viewer/js/View2D.js (removed)
@@ -1,939 +0,0 @@
-//===-- View2D.js - HTML5 Canvas Based 2D View/Graph Widget ---------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements a generic 2D view widget and a 2D graph widget on top of
-// it, using the HTML5 Canvas. It currently supports Chrome, Firefox, and
-// Safari.
-//
-// See the Graph2D implementation for details of how to extend the View2D
-// object.
-//
-//===----------------------------------------------------------------------===//
-
-function lerp(a, b, t) {
- return a * (1.0 - t) + b * t;
-}
-
-function clamp(a, lower, upper) {
- return Math.max(lower, Math.min(upper, a));
-}
-
-function vec2_neg (a) { return [-a[0] , -a[1] ]; };
-function vec2_add (a, b) { return [a[0]+b[0], a[1]+b[1]]; };
-function vec2_addN(a, b) { return [a[0]+b , a[1]+b ]; };
-function vec2_sub (a, b) { return [a[0]-b[0], a[1]-b[1]]; };
-function vec2_subN(a, b) { return [a[0]-b , a[1]-b ]; };
-function vec2_mul (a, b) { return [a[0]*b[0], a[1]*b[1]]; };
-function vec2_mulN(a, b) { return [a[0]*b , a[1]*b ]; };
-function vec2_div (a, b) { return [a[0]/b[0], a[1]/b[1]]; };
-function vec2_divN(a, b) { return [a[0]/b , a[1]/b ]; };
-
-function vec3_neg (a) { return [-a[0] , -a[1] , -a[2] ]; };
-function vec3_add (a, b) { return [a[0]+b[0], a[1]+b[1], a[2]+b[2]]; };
-function vec3_addN(a, b) { return [a[0]+b , a[1]+b, a[2]+b ]; };
-function vec3_sub (a, b) { return [a[0]-b[0], a[1]-b[1], a[2]-b[2]]; };
-function vec3_subN(a, b) { return [a[0]-b , a[1]-b, a[2]-b ]; };
-function vec3_mul (a, b) { return [a[0]*b[0], a[1]*b[1], a[2]*b[2]]; };
-function vec3_mulN(a, b) { return [a[0]*b , a[1]*b, a[2]*b ]; };
-function vec3_div (a, b) { return [a[0]/b[0], a[1]/b[1], a[2]/b[2]]; };
-function vec3_divN(a, b) { return [a[0]/b , a[1]/b, a[2]/b ]; };
-
-function vec2_lerp(a, b, t) {
- return [lerp(a[0], b[0], t), lerp(a[1], b[1], t)];
-}
-function vec2_mag(a) {
- return a[0] * a[0] + a[1] * a[1];
-}
-function vec2_len(a) {
- return Math.sqrt(vec2_mag(a));
-}
-
-function vec2_floor(a) {
- return [Math.floor(a[0]), Math.floor(a[1])];
-}
-function vec2_ceil(a) {
- return [Math.ceil(a[0]), Math.ceil(a[1])];
-}
-
-function vec3_floor(a) {
- return [Math.floor(a[0]), Math.floor(a[1]), Math.floor(a[2])];
-}
-function vec3_ceil(a) {
- return [Math.ceil(a[0]), Math.ceil(a[1]), Math.ceil(a[2])];
-}
-
-function vec2_log(a) {
- return [Math.log(a[0]), Math.log(a[1])];
-}
-function vec2_pow(a, b) {
- return [Math.pow(a[0], b[0]), Math.pow(a[1], b[1])];
-}
-function vec2_Npow(a, b) {
- return [Math.pow(a, b[0]), Math.pow(a, b[1])];
-}
-function vec2_powN(a, b) {
- return [Math.pow(a[0], b), Math.pow(a[1], b)];
-}
-
-function vec2_min(a, b) {
- return [Math.min(a[0], b[0]), Math.min(a[1], b[1])];
-}
-function vec2_max(a, b) {
- return [Math.max(a[0], b[0]), Math.max(a[1], b[1])];
-}
-function vec2_clamp(a, lower, upper) {
- return [clamp(a[0], lower[0], upper[0]),
- clamp(a[1], lower[1], upper[1])];
-}
-function vec2_clampN(a, lower, upper) {
- return [clamp(a[0], lower, upper),
- clamp(a[1], lower, upper)];
-}
-
-function vec3_min(a, b) {
- return [Math.min(a[0], b[0]), Math.min(a[1], b[1]), Math.min(a[2], b[2])];
-}
-function vec3_max(a, b) {
- return [Math.max(a[0], b[0]), Math.max(a[1], b[1]), Math.max(a[2], b[2])];
-}
-function vec3_clamp(a, lower, upper) {
- return [clamp(a[0], lower[0], upper[0]),
- clamp(a[1], lower[1], upper[1]),
- clamp(a[2], lower[2], upper[2])];
-}
-function vec3_clampN(a, lower, upper) {
- return [clamp(a[0], lower, upper),
- clamp(a[1], lower, upper),
- clamp(a[2], lower, upper)];
-}
-
-function vec2_cswap(a, swap) {
- if (swap)
- return [a[1],a[0]];
- return a;
-}
-
-function col3_to_rgb(col) {
- var norm = vec3_floor(vec3_clampN(vec3_mulN(col, 255), 0, 255));
- return "rgb(" + norm[0] + "," + norm[1] + "," + norm[2] + ")";
-}
-
-function col4_to_rgba(col) {
- var norm = vec3_floor(vec3_clampN(vec3_mulN(col, 255), 0, 255));
- return "rgb(" + norm[0] + "," + norm[1] + "," + norm[2] + "," + col[3] + ")";
-}
-
-/* ViewData Class */
-
-function ViewData(location, scale) {
- if (!location)
- location = [0, 0];
- if (!scale)
- scale = [1, 1];
-
- this.location = location;
- this.scale = scale;
-}
-
-ViewData.prototype.copy = function() {
- return new ViewData(this.location, this.scale);
-}
-
-/* ViewAction Class */
-function ViewAction(mode, v2d, start) {
- this.mode = mode;
- this.start = start;
- this.vd = v2d.viewData.copy();
-}
-
-ViewAction.prototype.update = function(v2d, co) {
- if (this.mode == 'p') {
- var delta = vec2_sub(v2d.convertClientToNDC(co, this.vd),
- v2d.convertClientToNDC(this.start, this.vd))
- v2d.viewData.location = vec2_add(this.vd.location, delta);
- } else {
- var delta = vec2_sub(v2d.convertClientToNDC(co, this.vd),
- v2d.convertClientToNDC(this.start, this.vd))
- v2d.viewData.scale = vec2_Npow(Math.E,
- vec2_addN(vec2_log(this.vd.scale),
- delta[1]))
- v2d.viewData.location = vec2_mul(this.vd.location,
- vec2_div(v2d.viewData.scale,
- this.vd.scale))
- }
-
- v2d.refresh();
-}
-
-ViewAction.prototype.complete = function(v2d, co) {
- this.update(v2d, co);
-}
-
-ViewAction.prototype.abort = function(v2d) {
- v2d.viewData = this.vd;
-}
-
-/* EventWrapper Class */
-
-function EventWrapper(domevent) {
- this.domevent = domevent;
- this.client = {
- x: domevent.clientX,
- y: domevent.clientY,
- };
- this.alt = domevent.altKey;
- this.shift = domevent.shiftKey;
- this.meta = domevent.metaKey;
- this.wheel = (domevent.wheelDelta) ? domevent.wheelDelta / 120 : -(domevent.detail || 0) / 3;
-}
-
-EventWrapper.prototype.stop = function() {
- this.domevent.stopPropagation();
- this.domevent.preventDefault();
-}
-
-/* View2D Class */
-
-function View2D(canvasname) {
- this.canvasname = canvasname;
- this.viewData = new ViewData();
- this.size = [1, 1];
- this.aspect = 1;
- this.registered = false;
-
- this.viewAction = null;
-
- this.useWidgets = true;
- this.previewPosition = [5, 5];
- this.previewSize = [60, 60];
-
- this.clearColor = [1, 1, 1];
-
- // Bound once registered.
- this.canvas = null;
-}
-
-View2D.prototype.registerEvents = function(canvas) {
- if (this.registered)
- return;
-
- this.registered = true;
-
- this.canvas = canvas;
-
- // FIXME: Why do I have to do this?
- var obj = this;
-
- canvas.onmousedown = function(event) { obj.onMouseDown(new EventWrapper(event)); };
- canvas.onmousemove = function(event) { obj.onMouseMove(new EventWrapper(event)); };
- canvas.onmouseup = function(event) { obj.onMouseUp(new EventWrapper(event)); };
- canvas.onmousewheel = function(event) { obj.onMouseWheel(new EventWrapper(event)); };
- if (canvas.addEventListener) {
- canvas.addEventListener('DOMMouseScroll', function(event) { obj.onMouseWheel(new EventWrapper(event)); }, false);
- }
-
- // FIXME: Capturing!
-}
-
-View2D.prototype.onMouseDown = function(event) {
- pos = [event.client.x - this.canvas.offsetLeft,
- this.size[1] - 1 - (event.client.y - this.canvas.offsetTop)];
-
- if (this.viewAction != null)
- this.viewAction.abort(this);
-
- if (event.shift)
- this.viewAction = new ViewAction('p', this, pos);
- else if (event.alt || event.meta)
- this.viewAction = new ViewAction('z', this, pos);
- event.stop();
-}
-
-View2D.prototype.onMouseMove = function(event) {
- pos = [event.client.x - this.canvas.offsetLeft,
- this.size[1] - 1 - (event.client.y - this.canvas.offsetTop)];
-
- if (this.viewAction != null)
- this.viewAction.update(this, pos);
- event.stop();
-}
-
-View2D.prototype.onMouseUp = function(event) {
- pos = [event.client.x - this.canvas.offsetLeft,
- this.size[1] - 1 - (event.client.y - this.canvas.offsetTop)];
-
- if (this.viewAction != null)
- this.viewAction.complete(this, pos);
- this.viewAction = null;
- event.stop();
-}
-
-View2D.prototype.onMouseWheel = function(event) {
- if (this.viewAction == null) {
- var factor = event.wheel;
- if (event.shift)
- factor *= .1;
- var zoom = 1.0 + .03 * factor;
- this.viewData.location = vec2_mulN(this.viewData.location, zoom);
- this.viewData.scale = vec2_mulN(this.viewData.scale, zoom);
-
- // Arbitrary limit min and max scales for now, ideally would be derived
- // based on the view contents.
- this.viewData.scale = vec2_clampN(this.viewData.scale, 10e-6, 10e6);
-
- this.refresh();
- }
- event.stop();
-}
-
-View2D.prototype.setViewData = function(vd) {
- // FIXME: Check equality and avoid refresh.
- this.viewData = vd;
- this.refresh();
-}
-
-View2D.prototype.refresh = function() {
- // FIXME: Event loop?
- this.draw();
-}
-
-// Coordinate conversion.
-
-View2D.prototype.getAspectScale = function() {
- if (this.aspect > 1) {
- return [1.0 / this.aspect, 1.0];
- } else {
- return [1.0, this.aspect];
- }
-}
-
-View2D.prototype.getPixelSize = function() {
- return vec2_sub(this.convertClientToWorld([1,1]),
- this.convertClientToWorld([0,0]));
-}
-
-View2D.prototype.convertClientToNDC = function(pt, vd) {
- if (vd == null)
- vd = this.viewData
- return [pt[0] / this.size[0] * 2 - 1,
- pt[1] / this.size[1] * 2 - 1];
-}
-
-View2D.prototype.convertClientToWorld = function(pt, vd) {
- if (vd == null)
- vd = this.viewData
- pt = this.convertClientToNDC(pt, vd)
- pt = vec2_sub(pt, vd.location);
- pt = vec2_div(pt, vec2_mul(vd.scale, this.getAspectScale()));
- return pt;
-}
-
-View2D.prototype.convertWorldToPreview = function(pt, pos, size) {
- var asp_scale = this.getAspectScale();
- pt = vec2_mul(pt, asp_scale);
- pt = vec2_addN(pt, 1);
- pt = vec2_mulN(pt, .5);
- pt = vec2_mul(pt, size);
- pt = vec2_add(pt, pos);
- return pt;
-}
-
-View2D.prototype.setViewMatrix = function(ctx) {
- ctx.scale(this.size[0], this.size[1]);
- ctx.scale(.5, .5);
- ctx.translate(1, 1);
- ctx.translate(this.viewData.location[0], this.viewData.location[1]);
- var scale = vec2_mul(this.viewData.scale, this.getAspectScale());
- ctx.scale(scale[0], scale[1]);
-}
-
-View2D.prototype.setPreviewMatrix = function(ctx, pos, size) {
- ctx.translate(pos[0], pos[1]);
- ctx.scale(size[0], size[1]);
- ctx.scale(.5, .5);
- ctx.translate(1, 1);
- var scale = this.getAspectScale();
- ctx.scale(scale[0], scale[1]);
-}
-
-View2D.prototype.setWindowMatrix = function(ctx) {
- ctx.translate(.5, .5);
- ctx.translate(0, this.size[1]);
- ctx.scale(1, -1);
-}
-
-View2D.prototype.draw = function() {
- var canvas = document.getElementById(this.canvasname);
- var ctx = canvas.getContext("2d");
-
- this.registerEvents(canvas);
-
- if (canvas.width != this.size[0] || canvas.height != this.size[1]) {
- this.size = [canvas.width, canvas.height];
- this.aspect = canvas.width / canvas.height;
- this.previewPosition[0] = this.size[0] - this.previewSize[0] - 5;
- this.on_size_change();
- }
-
- this.on_draw_start();
-
- ctx.save();
-
- // Clear and draw the view content.
- ctx.save();
- this.setWindowMatrix(ctx);
-
- ctx.clearRect(0, 0, this.size[0], this.size[1]);
- ctx.fillStyle = col3_to_rgb(this.clearColor);
- ctx.fillRect(0, 0, this.size[0], this.size[1]);
-
- this.setViewMatrix(ctx);
- this.on_draw(canvas, ctx);
- ctx.restore();
-
- if (this.useWidgets)
- this.drawPreview(canvas, ctx)
-
- ctx.restore();
-}
-
-View2D.prototype.drawPreview = function(canvas, ctx) {
- // Setup the preview context.
- this.setWindowMatrix(ctx);
-
- // Draw the preview area outline.
- ctx.fillStyle = "rgba(128,128,128,.5)";
- ctx.fillRect(this.previewPosition[0]-1, this.previewPosition[1]-1,
- this.previewSize[0]+2, this.previewSize[1]+2);
- ctx.lineWidth = 1;
- ctx.strokeStyle = "rgb(0,0,0)";
- ctx.strokeRect(this.previewPosition[0]-1, this.previewPosition[1]-1,
- this.previewSize[0]+2, this.previewSize[1]+2);
-
- // Compute the aspect corrected preview area.
- var pv_size = [this.previewSize[0], this.previewSize[1]];
- if (this.aspect > 1) {
- pv_size[1] /= this.aspect;
- } else {
- pv_size[0] *= this.aspect;
- }
- var pv_pos = vec2_add(this.previewPosition,
- vec2_mulN(vec2_sub(this.previewSize, pv_size), .5));
-
- // Draw the preview, making sure to clip to the proper area.
- ctx.save();
- ctx.beginPath();
- ctx.rect(pv_pos[0], pv_pos[1], pv_size[0], pv_size[1]);
- ctx.clip();
- ctx.closePath();
-
- this.setPreviewMatrix(ctx, pv_pos, pv_size);
- this.on_draw_preview(canvas, ctx);
- ctx.restore();
-
- // Draw the current view overlay.
- //
- // FIXME: Find a replacement for stippling.
- ll = this.convertClientToWorld([0, 0])
- ur = this.convertClientToWorld(this.size);
-
- // Convert to pixel coordinates instead of drawing in content
- // perspective.
- ll = vec2_floor(this.convertWorldToPreview(ll, pv_pos, pv_size))
- ur = vec2_ceil(this.convertWorldToPreview(ur, pv_pos, pv_size))
- ll = vec2_clamp(ll, this.previewPosition,
- vec2_add(this.previewPosition, this.previewSize))
- ur = vec2_clamp(ur, this.previewPosition,
- vec2_add(this.previewPosition, this.previewSize))
-
- ctx.strokeStyle = "rgba(128,128,128,255)";
- ctx.lineWidth = 1;
- ctx.strokeRect(ll[0], ll[1], ur[0] - ll[0], ur[1] - ll[1]);
-}
-
-View2D.prototype.on_size_change = function() {}
-View2D.prototype.on_draw_start = function() {}
-View2D.prototype.on_draw = function(canvas, ctx) {}
-View2D.prototype.on_draw_preview = function(canvas, ctx) {}
-
-/* View2DTest Class */
-
-function View2DTest(canvasname) {
- View2D.call(this, canvasname);
-}
-View2DTest.prototype = new View2D();
-View2DTest.prototype.constructor = View2DTest;
-
-View2DTest.prototype.on_draw = function(canvas, ctx) {
- ctx.fillStyle = "rgb(255,255,255)";
- ctx.fillRect(-1000, -1000, 2000, 20000);
-
- ctx.lineWidth = .01;
- ctx.strokeTyle = "rgb(0,200,0)";
- ctx.strokeRect(-1, -1, 2, 2);
-
- ctx.fillStyle = "rgb(200,0,0)";
- ctx.fillRect(-.8, -.8, 1, 1);
-
- ctx.fillStyle = "rgb(0,0,200)";
- ctx.beginPath();
- ctx.arc(0, 0, .5, 0, 2 * Math.PI, false);
- ctx.fill();
- ctx.closePath();
-}
-
-View2DTest.prototype.on_draw_preview = function(canvas, ctx) {
- ctx.fillStyle = "rgba(255,255,255,.4)";
- ctx.fillRect(-1000, -1000, 2000, 20000);
-
- ctx.lineWidth = .01;
- ctx.strokeTyle = "rgba(0,200,0,.4)";
- ctx.strokeRect(-1, -1, 2, 2);
-
- ctx.fillStyle = "rgba(200,0,0,.4)";
- ctx.fillRect(-.8, -.8, 1, 1);
-
- ctx.fillStyle = "rgba(0,0,200,.4)";
- ctx.beginPath();
- ctx.arc(0, 0, .5, 0, 2 * Math.PI, false);
- ctx.fill();
- ctx.closePath();
-}
-
-/* Graph2D_GraphInfo Class */
-
-function Graph2D_GraphInfo() {
- this.xAxisH = 0;
- this.yAxisW = 0;
- this.ll = [0, 0];
- this.ur = [1, 1];
-}
-
-Graph2D_GraphInfo.prototype.toNDC = function(pt) {
- return [2 * (pt[0] - this.ll[0]) / (this.ur[0] - this.ll[0]) - 1,
- 2 * (pt[1] - this.ll[1]) / (this.ur[1] - this.ll[1]) - 1];
-}
-
-Graph2D_GraphInfo.prototype.fromNDC = function(pt) {
- return [this.ll[0] + (this.ur[0] - this.ll[0]) * (pt[0] + 1) * .5,
- this.ll[1] + (this.ur[1] - this.ll[1]) * (pt[1] + 1) * .5];
-}
-
-/* Graph2D_PlotStyle Class */
-
-function Graph2D_PlotStyle() {
-}
-
-Graph2D_PlotStyle.prototype.plot = function(graph, ctx, data) {}
-
-/* Graph2D_LinePlotStyle Class */
-
-function Graph2D_LinePlotStyle(width, color) {
- Graph2D_PlotStyle.call(this);
-
- if (!width)
- width = 1;
- if (!color)
- color = [0,0,0];
-
- this.width = width;
- this.color = color;
-}
-Graph2D_LinePlotStyle.prototype = new Graph2D_PlotStyle();
-Graph2D_LinePlotStyle.prototype.constructor = Graph2D_LinePlotStyle;
-
-Graph2D_LinePlotStyle.prototype.plot = function(graph, ctx, data) {
- if (data.length === 0)
- return;
-
- ctx.beginPath();
- var co = graph.graphInfo.toNDC(data[0]);
- ctx.moveTo(co[0], co[1]);
- for (var i = 1, e = data.length; i != e; ++i) {
- var co = graph.graphInfo.toNDC(data[i]);
- ctx.lineTo(co[0], co[1]);
- }
- ctx.lineWidth = this.width * (graph.getPixelSize()[0] + graph.getPixelSize()[1]) * .5;
- ctx.strokeStyle = col3_to_rgb(this.color);
- ctx.stroke();
-}
-
-/* Graph2D_PointPlotStyle Class */
-
-function Graph2D_PointPlotStyle(width, color) {
- Graph2D_PlotStyle.call(this);
-
- if (!width)
- width = 1;
- if (!color)
- color = [0,0,0];
-
- this.width = width;
- this.color = color;
-}
-Graph2D_PointPlotStyle.prototype = new Graph2D_PlotStyle();
-Graph2D_PointPlotStyle.prototype.constructor = Graph2D_PointPlotStyle;
-
-Graph2D_PointPlotStyle.prototype.plot = function(graph, ctx, data) {
- if (data.length === 0)
- return;
-
- ctx.beginPath();
- var radius = this.width * (graph.getPixelSize()[0] + graph.getPixelSize()[1]) * .5;
- for (var i = 0, e = data.length; i != e; ++i) {
- var co = graph.graphInfo.toNDC(data[i]);
- ctx.moveTo(co[0], co[1]);
- ctx.arc(co[0], co[1], radius, 0, Math.PI * 2, /*anticlockwise=*/false);
- }
- ctx.fillStyle = col3_to_rgb(this.color);
- ctx.fill();
-}
-
-/* Graph2D_ErrorBarPlotStyle Class */
-
-function Graph2D_ErrorBarPlotStyle(width, color) {
- Graph2D_PlotStyle.call(this);
-
- if (!width)
- width = 1;
- if (!color)
- color = [0,0,0];
-
- this.width = width;
- this.color = color;
-}
-Graph2D_ErrorBarPlotStyle.prototype = new Graph2D_PlotStyle();
-Graph2D_ErrorBarPlotStyle.prototype.constructor = Graph2D_ErrorBarPlotStyle;
-
-Graph2D_ErrorBarPlotStyle.prototype.plot = function(graph, ctx, data) {
- if (data.length === 0)
- return;
-
- ctx.beginPath();
- for (var i = 0, e = data.length; i != e; ++i) {
- var co_min = graph.graphInfo.toNDC([data[i][0], data[i][1]]);
- var co_max = graph.graphInfo.toNDC([data[i][0], data[i][2]]);
- ctx.moveTo(co_min[0], co_min[1]);
- ctx.lineTo(co_max[0], co_max[1]);
- }
- ctx.lineWidth = this.width * (graph.getPixelSize()[0] + graph.getPixelSize()[1]) * .5;
- ctx.strokeStyle = col3_to_rgb(this.color);
- ctx.stroke();
-}
-
-/* Graph2D_Axis Class */
-
-function Graph2D_Axis(dir, format) {
- if (!format)
- format = this.formats.normal;
-
- this.dir = dir;
- this.format = format;
-}
-
-// Static Methods
-Graph2D_Axis.prototype.formats = {
- normal: function(value, iDigits, fDigits) {
- // FIXME: iDigits?
- return value.toFixed(fDigits);
- },
- day: function(value, iDigits, fDigits) {
- var date = new Date(value * 1000.);
- var res = date.getUTCFullYear();
- res += "-" + (date.getUTCMonth() + 1);
- res += "-" + (date.getUTCDate() + 1);
- return res;
- },
-};
-
-Graph2D_Axis.prototype.draw = function(graph, ctx, ll, ur, mainUR) {
- var dir = this.dir, ndir = 1 - this.dir;
- var vMin = ll[dir];
- var vMax = ur[dir];
- var near = ll[ndir];
- var far = ur[ndir];
- var border = mainUR[ndir];
-
- var line_base = (graph.getPixelSize()[0] + graph.getPixelSize()[1]) * .5;
- ctx.lineWidth = 2 * line_base;
- ctx.strokeStyle = "rgb(0,0,0)";
-
- ctx.beginPath();
- var co = vec2_cswap([vMin, far], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.moveTo(co[0], co[1]);
- var co = vec2_cswap([vMax, far], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.lineTo(co[0], co[1]);
- ctx.stroke();
-
- var delta = vMax - vMin;
- var steps = Math.floor(Math.log(delta) / Math.log(10));
- if (delta / Math.pow(10, steps) >= 5.0) {
- var size = .5;
- } else if (delta / Math.pow(10, steps) >= 2.5) {
- var size = .25;
- } else {
- var size = .1;
- }
- size *= Math.pow(10, steps);
-
- if (steps <= 0) {
- var iDigits = 0, fDigits = 1 + Math.abs(steps);
- } else {
- var iDigits = steps, fDigits = 0;
- }
-
- var start = Math.ceil(vMin / size);
- var end = Math.ceil(vMax / size);
-
- // FIXME: Draw in window coordinates to make crisper.
-
- // FIXME: Draw grid in layers to avoid ugly overlaps.
-
- for (var i = start; i != end; ++i) {
- if (i == 0) {
- ctx.lineWidth = 3 * line_base;
- var p = .5;
- } else if (!(i & 1)) {
- ctx.lineWidth = 2 * line_base;
- var p = .5;
- } else {
- ctx.lineWidth = 1 * line_base;
- var p = .75;
- }
-
- ctx.beginPath();
- var co = vec2_cswap([i * size, lerp(near, far, p)], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.moveTo(co[0], co[1]);
- var co = vec2_cswap([i * size, far], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.lineTo(co[0], co[1]);
- ctx.stroke();
- }
-
- for (var alt = 0; alt < 2; ++alt) {
- if (alt)
- ctx.strokeStyle = "rgba(190,190,190,.5)";
- else
- ctx.strokeStyle = "rgba(128,128,128,.5)";
- ctx.lineWidth = 1 * line_base;
- ctx.beginPath();
- for (var i = start; i != end; ++i) {
- if (i == 0)
- continue;
- if ((i & 1) == alt) {
- var co = vec2_cswap([i * size, far], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.moveTo(co[0], co[1]);
- var co = vec2_cswap([i * size, border], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.lineTo(co[0], co[1]);
- }
- }
- ctx.stroke();
-
- if (start <= 0 && 0 < end) {
- ctx.beginPath();
- var co = vec2_cswap([0, far], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.moveTo(co[0], co[1]);
- var co = vec2_cswap([0, border], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.lineTo(co[0], co[1]);
- ctx.strokeStyle = "rgba(64,64,64,.5)";
- ctx.lineWidth = 3 * line_base;
- ctx.stroke();
- }
- }
-
- // FIXME: Draw this in screen coordinates, and stop being stupid. Also,
- // figure out font height?
- if (this.dir == 1) {
- var offset = [-.5, -.25];
- } else {
- var offset = [-.5, 1.1];
- }
- ctx.fillStyle = "rgb(0,0,0)";
- var pxl = graph.getPixelSize();
- for (var i = start; i != end; ++i) {
- if ((i & 1) == 0) {
- var label = this.format(i * size, iDigits, fDigits);
- ctx.save();
- var co = vec2_cswap([i*size, lerp(near, far, .5)], dir);
- co = graph.graphInfo.toNDC(co);
- ctx.translate(co[0], co[1]);
- ctx.scale(pxl[0], -pxl[1]);
- // FIXME: Abstract.
- var bb_w = label.length * 5;
- if (ctx.measureText != null)
- bb_w = ctx.measureText(label).width;
- var bb_h = 12;
- // FIXME: Abstract? Or ignore.
- if (ctx.fillText != null) {
- ctx.fillText(label, bb_w*offset[0], bb_h*offset[1]);
- } else if (ctx.mozDrawText != null) {
- ctx.translate(bb_w*offset[0], bb_h*offset[1]);
- ctx.mozDrawText(label);
- }
- ctx.restore();
- }
- }
-}
-
-
-/* Graph2D Class */
-
-function Graph2D(canvasname) {
- View2D.call(this, canvasname)
-
- this.useWidgets = false;
- this.plots = [];
- this.graphInfo = null;
- this.xAxis = new Graph2D_Axis(0);
- this.yAxis = new Graph2D_Axis(1);
- this.debugText = null;
-
- this.clearColor = [.8, .8, .8];
-}
-Graph2D.prototype = new View2D();
-Graph2D.prototype.constructor = Graph2D;
-
-//
-
-Graph2D.prototype.graphChanged = function() {
- this.graphInfo = null;
- // FIXME: Need event loop.
- this.refresh();
-}
-
-Graph2D.prototype.layoutGraph = function() {
- var gi = new Graph2D_GraphInfo();
-
- gi.xAxisH = 40;
- gi.yAxisW = 60;
-
- var min = null, max = null;
- for (var i = 0, e = this.plots.length; i != e; ++i) {
- var data = this.plots[i][0];
- for (var i2 = 0, e2 = data.length; i2 != e2; ++i2) {
- if (min == null)
- min = data[i2];
- else
- min = vec2_min(min, data[i2]);
-
- if (max == null)
- max = data[i2];
- else
- max = vec2_max(max, data[i2]);
- }
- }
-
- if (min === null)
- min = [0, 0];
- if (max === null)
- max = [0, 0];
- if (Math.abs(max[0] - min[0]) < .001)
- max[0] += 1;
- if (Math.abs(max[1] - min[1]) < .001)
- max[1] += 1;
-
- // Set graph transform to the [min,max] rect to the content area with
- // some padding.
- //
- // FIXME: Add real mat3 and implement this properly.
- var pad = 5;
- var vd = new ViewData();
- var ll_target = this.convertClientToWorld([gi.yAxisW + pad, gi.xAxisH + pad], vd);
- var ur_target = this.convertClientToWorld(vec2_subN(this.size, pad), vd);
- var target_size = vec2_sub(ur_target, ll_target);
- var target_center = vec2_add(ll_target, vec2_mulN(target_size, .5));
-
- var center = vec2_mulN(vec2_add(min, max), .5);
- var size = vec2_sub(max, min);
-
- var scale = vec2_mulN(target_size, .5);
- size = vec2_div(size, scale);
- center = vec2_sub(center, vec2_mulN(vec2_mul(target_center, size), .5));
-
- gi.ll = vec2_sub(center, vec2_mulN(size, .5));
- gi.ur = vec2_add(center, vec2_mulN(size, .5));
-
- return gi;
-}
-
-//
-
-Graph2D.prototype.convertClientToGraph = function(pt) {
- return this.graphInfo.fromNDC(this.convertClientToWorld(pt));
-}
-
-//
-
-Graph2D.prototype.on_size_change = function() {
- this.graphInfo = null;
-}
-
-Graph2D.prototype.on_draw_start = function() {
- if (!this.graphInfo)
- this.graphInfo = this.layoutGraph();
-}
-
-Graph2D.prototype.on_draw = function(canvas, ctx) {
- var gi = this.graphInfo;
- var w = this.size[0], h = this.size[1];
-
- this.xAxis.draw(this, ctx,
- this.convertClientToGraph([gi.yAxisW, 0]),
- this.convertClientToGraph([w, gi.xAxisH]),
- this.convertClientToGraph([w, h]))
- this.yAxis.draw(this, ctx,
- this.convertClientToGraph([0, gi.xAxisH]),
- this.convertClientToGraph([gi.yAxisW, h]),
- this.convertClientToGraph([w, h]))
-
- if (this.debugText != null) {
- ctx.save();
- ctx.setTransform(1, 0, 0, 1, 0, 0);
- ctx.fillText(this.debugText, this.size[0]/2 + 10, this.size[1]/2 + 10);
- ctx.restore();
- }
-
- // Draw the contents.
- ctx.save();
- ctx.beginPath();
- var content_ll = this.convertClientToWorld([gi.yAxisW, gi.xAxisH]);
- var content_ur = this.convertClientToWorld(this.size);
- ctx.rect(content_ll[0], content_ll[1],
- content_ur[0]-content_ll[0], content_ur[1]-content_ll[1]);
- ctx.clip();
-
- for (var i = 0, e = this.plots.length; i != e; ++i) {
- var data = this.plots[i][0];
- var style = this.plots[i][1];
- style.plot(this, ctx, data);
- }
- ctx.restore();
-}
-
-// Client API.
-
-Graph2D.prototype.clearPlots = function() {
- this.plots = [];
- this.graphChanged();
-}
-
-Graph2D.prototype.addPlot = function(data, style) {
- if (!style)
- style = new Graph2D_LinePlotStyle(1);
- this.plots.push( [data, style] );
- this.graphChanged();
-}
-
Removed: zorg/trunk/lnt/lnt/viewer/js/View2DTest.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/js/View2DTest.html?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/js/View2DTest.html (original)
+++ zorg/trunk/lnt/lnt/viewer/js/View2DTest.html (removed)
@@ -1,61 +0,0 @@
-<html>
- <head>
- <title>View2D Test</title>
- <script src="View2D.js"></script>
- <script type="text/javascript">
-var viewA, viewB, graphA;
-
-function init() {
- viewA = new View2DTest("view2d");
- viewA.viewData.location = [-.2, -.15];
- viewA.viewData.scale = [2, 2];
- viewA.draw();
-
- viewB = new View2DTest("view2d_2");
- viewB.viewData.location = [-.2, -.15];
- viewB.viewData.scale = [.5, .5];
- viewB.draw();
-
- var pts_0 = [ [0, 0], [1, 1.3], [2, 2.2], [3, 1.3], [4, 4],
- [5,3], [6, 4], [7, 4.4]];
- pts_0 = pts_0.map(function(item, index, array) {
- return vec2_mulN(item, .1);
- });
- var pts_1 = pts_0.map(function(item, index, array) {
- return [item[0], .2 + item[1] * (1 - item[0] / 2)];
- });
- var pts_2 = pts_0.map(function(item, index, array) {
- return [item[0], 1 - item[1]];
- });
- var pts_3 = pts_0.map(function(item, index, array) {
- return [item[0], item[1] - .1, item[1] + .1];
- });
- graphA = new Graph2D("graph2d");
-if (1) {
- graphA.addPlot(pts_0, new Graph2D_LinePlotStyle(2));
- graphA.addPlot(pts_1);
- graphA.addPlot(pts_2, new Graph2D_LinePlotStyle(null, [1,0,0]));
- graphA.addPlot(pts_0, new Graph2D_PointPlotStyle(5, [.8, .5, 0]));
- graphA.addPlot(pts_3, new Graph2D_ErrorBarPlotStyle(1, [0, 1, 0]));
-} else {
- graphA.addPlot([[1248617856.000000,1.398600],[1248960469.000000,1.241700],[1249396047.000000,1.214300],[1249488792.000000,1.211600],[1249564554.000000,1.239500],[1249732514.000000,1.239200],[1249819044.000000,1.236300],[1249910746.000000,1.234200],[1249996733.000000,1.236000],[1250083258.000000,1.252600],[1250255237.000000,1.260400],[1250341501.000000,1.253500],[1250427966.000000,1.262600],[1250514329.000000,1.261600],[1250600211.000000,1.249100],[1250686801.000000,1.250700],[1250773065.000000,1.255400],[1250859519.000000,1.246300],[1250946756.000000,1.245900],[1251032239.000000,1.238200],[1251118837.000000,1.238000],[1251205034.000000,1.241900],[1251292148.000000,1.236500],[1251379354.000000,1.230200],[1251466226.000000,1.228700],[1251552218.000000,1.233600],[1251638633.000000,1.222400],[1251725230.000000,1.222100],[1251811608.000000,1.239100],[1251898565.000000,1.230200],[1251984695.000000,1.241700],[1252070572.000000,1.205800],[1252157268.000000,1.211100],[1252243914.
000000,1.210300],[1252330714.000000,1.206000],[1252416809.000000,1.210800],[1252590190.000000,1.216800],[1252675459.000000,1.214400],[1252762486.000000,1.220700],[1252886652.000000,1.221700],[1252935938.000000,1.215200],[1253021864.000000,1.213800],[1253108596.000000,1.213800],[1253194864.000000,1.231900],[1253281344.000000,1.232000],[1253366664.000000,1.238400],[1253453169.000000,1.232500],[1253539839.000000,1.230100],[1253627357.000000,1.232600],[1253713381.000000,1.235700],[1253799754.000000,1.232400],[1253886021.000000,1.241900],[1253972269.000000,1.229700],[1254058753.000000,1.229100],[1254145361.000000,1.284000],[1254231276.000000,1.295200],[1254317581.000000,1.299800],[1254405166.000000,1.340600],[1254490117.000000,1.305300],[1254576631.000000,1.304100],[1254662979.000000,1.303700],[1254749498.000000,1.306800],[1254835808.000000,1.306200],[1254922190.000000,1.270100],[1255008713.000000,1.270900],[1255094924.000000,1.267300],[1255181629.000000,1.265100],[1255267916.000
000,1.283300],[1255354566.000000,1.285500],[1255440921.000000,1.287100],[1255526237.000000,1.269800],[1255613420.000000,1.318400],[1255700706.000000,1.301600],[1255786760.000000,1.305000],[1255873293.000000,1.305000],[1255959875.000000,1.438800],[1256046280.000000,1.437400],[1256132389.000000,1.439100],[1256218592.000000,1.461200],[1256304662.000000,1.464100],[1256391812.000000,1.462300],[1256478151.000000,1.469600],[1256564495.000000,1.472300],[1256823554.000000,1.474000],[1256909311.000000,1.477200],[1256996077.000000,1.459000],[1257082516.000000,1.426100],[1257258543.000000,1.433700],[1257344527.000000,1.452600],[1257431075.000000,1.440700],[1257516720.000000,1.443300],[1257602894.000000,1.503300],[1257863543.000000,1.550200],[1257948938.000000,1.532500],[1258035827.000000,1.534900],[1258122304.000000,1.535600],[1258207973.000000,1.546700],[1258294248.000000,1.534700],[1258382337.000000,1.544000],[1258551986.000000,1.509100],[1258640333.000000,1.554300],[1258728912.000000
,1.541100],[1258815149.000000,1.602700],[1258901720.000000,1.685900]]);
-graphA.xAxis.format = graphA.xAxis.formats.day;
-}
- graphA.draw();
-}
- </script>
- </head>
- <body onload="init()" bgcolor="#AAAAAA">
- <canvas id="graph2d" width="600" height="400"></canvas>
- <br>
- <table>
- <tr>
- <td><canvas id="view2d" width="300" height="200"></canvas></td>
- <td><canvas id="view2d_2" width="200" height="350"></canvas></td>
- </tr>
- </table>
- Shift-Left Mouse: Pan<br>
- Alt/Meta-Left Mouse: Zoom<br>
- Wheel: Zoom (<i>Shift Slows</i>)<br>
- </body>
-</html>
Removed: zorg/trunk/lnt/lnt/viewer/machines.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/machines.ptl?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/machines.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/machines.ptl (removed)
@@ -1,90 +0,0 @@
-# -*- python -*-
-
-"""
-Generic machine browsing UI.
-"""
-
-import sys
-from quixote import get_response, redirect
-from quixote.directory import Directory
-from quixote.errors import TraversalError
-
-class MachineUI(Directory):
- _q_exports = [""]
-
- def __init__(self, root, idstr):
- self.root = root
- try:
- self.id = int(idstr)
- except ValueError, exc:
- raise TraversalError(str(exc))
-
-
- def _q_index [html] (self):
- # Get a DB connection.
- db = self.root.getDB()
-
- m = db.getMachine(self.id)
-
- self.root.getHeader("Machine: %s:%d" % (m.name,m.number), '../..',
- components=(('browse','browse'),))
-
- # Show the machine info dictionary.
- """
- <table border=1 cellborder=1>
- <tr>
- <th>Key</th>
- <th>Value</th>
- </tr>
- </thead>
- """
- for mi in m.info.values():
- """
- <tr>
- <td>%s</td>
- <td>%s</td>
- </tr>""" % (mi.key, mi.value)
- """
- </table>
- """
-
- # List associated runs.
- """
- <h3>Associated Runs</h3>
- <table class="sortable" border=1 cellborder=1>
- <thead>
- <tr>
- <th>Run ID</th>
- <th>Start Time</th>
- <th>End Time</th>
- </tr>
- </thead>
- """
- for r in db.runs(machine=m):
- """
- <tr>
- <td><a href="../../runs/%d/">%d</a></td>
- <td>%s</td>
- <td>%s</td>
- </tr>
- """ % (r.id, r.id, r.start_time, r.end_time)
- """
- </table>
- """
-
- self.root.getFooter()
-
-class MachinesDirectory(Directory):
- _q_exports = [""]
-
- def __init__(self, root):
- Directory.__init__(self)
- self.root = root
-
- def _q_index [plain] (self):
- """
- machine access
- """
-
- def _q_lookup(self, component):
- return MachineUI(self.root, component)
Removed: zorg/trunk/lnt/lnt/viewer/nightlytest.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/nightlytest.ptl?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/nightlytest.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/nightlytest.ptl (removed)
@@ -1,650 +0,0 @@
-# -*- python -*-
-
-"""
-Nightly Test UI instance for actual nightly test data.
-"""
-
-# FIXME: The NTStyleBrowser abstraction is no longer useful. We should kill it.
-
-import sys
-import time
-
-import quixote
-from quixote.directory import Directory
-from quixote.errors import TraversalError
-
-import Util, NTStyleBrowser
-from Util import safediv
-from NTUtil import *
-
-from lnt.db.perfdb import Machine, Run
-
-class NightlyTestRunUI(NTStyleBrowser.TestRunUI):
- _q_exports = ["", "graphSingle"]
-
- def __init__(self, *args, **kwargs):
- NTStyleBrowser.TestRunUI.__init__(self, *args, **kwargs)
- self.popupDepth = 0
-
- def getParameters(self):
- return ()
-
- def renderFullContents [html] (self, db, run, compareTo, summary):
- """<p>"""
- self.getAllResults(db, run, compareTo, summary)
-
- def renderBriefContents [html] (self, db, run, compareTo, summary):
- if compareTo:
- self.getComparisonPopups(db, run, compareTo, summary)
-
- def renderCommonContents [html] (self, db, run, compareTo, summary):
- # Test suite failure information.
-
- failures = self.getFailuresForRun(db, run, summary)
-
- if compareTo is not None:
- prevFailures = self.getFailuresForRun(db, compareTo, summary)
- newFailures = [(name, list(set(items) -
- set(prevFailures.get(name,[]))))
- for name,items in failures.items()]
- newFailures = dict([(name, items)
- for name,items in newFailures
- if items])
-
- if newFailures:
- newFailures = sorted(newFailures.items())
- self.renderTestSuiteFailures('newTSFailures',
- '<b>New Test Suite Failures</b>',
- newFailures)
-
- failures = sorted(failures.items())
- self.renderTestSuiteFailures('tsFailures',
- 'Test Suite Failures', failures)
-
- def renderTestSuiteFailures [html] (self, id, title, failures):
- numFailures = sum([len(items) for _,items in failures])
- title = '%d %s (All)' % (numFailures, title)
-
- self.renderPopupBegin(id, title, True)
- self.renderPopupBegin(id+'.all', 'All', True)
- for name,items in failures:
- """
- %s <font color="grey">[%s]</font><br>
- """ % (name, ', '.join(items))
- self.renderPopupEnd()
-
- # Also show failure by type.
- byType = Util.multidict([(item,name)
- for name,items in failures
- for item in items])
- byType = sorted(byType.items())
-
- for i,(item,names) in enumerate(byType):
- title = '%d %s' % (len(names), item)
- self.renderPopupBegin(id+'.%d' % i, title, True)
- for name in names:
- """
- %s<br>""" % name
- self.renderPopupEnd()
-
- self.renderPopupEnd()
-
- def renderPopupBegin [html] (self, id, title, hidden):
- self.popupDepth += 1
- """\
- <p>
- <a href="javascript://" onclick="toggleLayer('%s')"; id="%s_">(%s) %s</a>
- <div id="%s" style="display: %s;" class="hideable_%d">
- """ % (id, id, ("+","-")[hidden], title, id, ("","none")[hidden],
- self.popupDepth)
- def renderPopupEnd [html] (self):
- """
- </div>"""
- self.popupDepth -= 1
-
- def getFailuresForRun(self, db, run, summary):
- failures = Util.multidict()
- for keyname,title in kTSKeys.items():
- for testname in summary.testNames:
- fullname = 'nightlytest.' + testname + '.' + keyname +'.success'
- t = summary.testMap.get(str(fullname))
- if t is None:
- continue
- samples = summary.getRunSamples(run).get(t.id)
- if not samples or samples[0]:
- continue
- failures[testname] = title
- return failures
-
- def getAllResults [html] (self, db, run, compareTo, summary):
- columns = [('GCCAS', 'gcc.compile.time', None, ()),
- ('Bitcode','bc.compile.size', None, ()),
- ('LLC<br>compile','llc.compile.time', None,
- ('bc.compile.size',)),
- ('LLC-BETA<br>compile','llc-beta.compile.time', None,
- ('bc.compile.size',)),
- ('JIT<br>codegen','jit.compile.time', None,
- ('bc.compile.size',)),
- ('GCC','gcc.exec.time', None, ('gcc.compile.time',)),
- ('CBE','cbe.exec.time', None, ('bc.compile.size',)),
- ('LLC','llc.exec.time', None, ('llc.compile.time',)),
- ('LLC-BETA','llc-beta.exec.time', None,
- ('llc-beta.compile.time',)),
- ('JIT','jit.exec.time', None, ('jit.compile.time',)),
- ('GCC/CBE','gcc.exec.time','cbe.exec.time', ()),
- ('GCC/LLC','gcc.exec.time','llc.exec.time', ()),
- ('GCC/LLC-BETA','gcc.exec.time','llc-beta.exec.time',()),
- ('LLC/LLC-BETA','llc.exec.time','llc-beta.exec.time',())]
-
- # Add interface to hiding columns by test or column type.
- keyIndices = Util.multidict()
- ratioIndices = []
- pctIndices = []
-
- idx = 1
- for info in columns:
- isCmp = info[2] is not None
- key = str(info[1]).split(str('.'))[0]
- if not isCmp:
- keyIndices[key] = idx
- keyIndices[key] = idx + 1
- pctIndices.append(idx + 1)
- idx += 2
- else:
- keyIndices[key] = idx
- ratioIndices.append(idx)
- idx += 1
- """
- <form>
- <table border="1">
- <thead>
- <tr>
- <th>Column Visibility</th>
- <th>GCC</th>
- <th>LLC</th>
- <th>CBE</th>
- <th>JIT</th>
- <th>LLC-BETA</th>
- <th>Percentages</th>
- <th>Ratios</th>
- </tr>
- </thead>
- <tr>
- <td>Enabled</td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- </tr>
- </table>
- </form>
- """ % (', '.join(map(str, keyIndices['gcc'])),
- ', '.join(map(str, keyIndices['llc'])),
- ', '.join(map(str, keyIndices['cbe'])),
- ', '.join(map(str, keyIndices['jit'])),
- ', '.join(map(str, keyIndices['llc-beta'])),
- ', '.join(map(str, pctIndices)),
- ', '.join(map(str, ratioIndices)))
-
- # The main table.
- """
- <table class="sortable" border="1" cellspacing="0" cellpadding="0" id="programs">
- <thead>
- <tr>
- <th>Program</th>
- """
- for name,key,cmp,dependsOn in columns:
- if cmp is None:
- """
- <th>%s</th>
- <th>%%<br>change<br>in<br>%s</th>
- """ % (name, name)
- else:
- """<th>%s</th>""" % name
- """
- </tr>
- </thead>
- """
-
- runSamples = summary.getRunSamples(run)
- prevSamples = summary.getRunSamples(compareTo)
- testNames = list(summary.testNames)
- testNames.sort(key = lambda x: x.lower())
- for testName in testNames:
- # FIXME: We need some id for the "program". The dotted name system
- # solves this...
- fullname = str('nightlytest.' + testName + '.' +
- 'gcc.compile.success')
- t = summary.testMap.get(fullname)
- assert t
- """
- <tr>
- <td><a href="../programs/%s/">%s</a></td>
- """ % (t.id, testName,)
-
- for name,key,cmp,dependsOn in columns:
- if cmp is None:
- fullname = str('nightlytest.' + testName + '.' + key)
- t = summary.testMap.get(fullname)
- if t is None:
- current = prev = None
- else:
- current = runSamples.get(t.id)
- prev = prevSamples.get(t.id)
- if current:
- value = current[0]
- if key.endswith('size'):
- """<td>%d</td>""" % int(value)
- else:
- """<td>%.4f</td>""" % value
- if prev:
- pct = safediv(value, prev[0],
- '<center><font size=-2>nan</font></center>')
- else:
- pct = 'N/A'
- else:
- # Only mark failure if nothing we depend on failed.
- failed = True
- for d in dependsOn:
- t = summary.testMap.get(str('nightlytest.' + testName + '.' + d))
- if not t or not runSamples.get(t.id):
- failed = False
- break
- if failed:
- """<td bgcolor="#FF0000">*</td>"""
- else:
- """<td>N/A</td>"""
- pct = 'N/A'
- Util.PctCell(pct, delta=True).render()
- else:
- tNum = summary.testMap.get(str('nightlytest.' + testName + '.' + key))
- tDen = summary.testMap.get(str('nightlytest.' + testName + '.' + cmp))
- if tNum is None or tDen is None:
- num = den = None
- else:
- num = runSamples.get(tNum.id)
- den = runSamples.get(tDen.id)
- if num and den:
- pct = safediv(num[0], den[0])
- if pct is None:
- """<td>N/A</td>"""
- else:
- """<td>%.2f</td>""" % (pct,)
- else:
- """<td>N/A</td>"""
- """
- </tr>
- """
- """
- </table>
- """
-
- def getComparisonPopups [html] (self, db, run, compareTo, summary):
- runSamples = summary.getRunSamples(run)
- prevSamples = summary.getRunSamples(compareTo)
-
- for i,(name,key) in enumerate(kComparisonKinds):
- if not key:
- # FIXME: File Size
- deltas = []
- else:
- deltas = []
- for testName in summary.testNames:
- fullname = str('nightlytest.' + testName + '.' + key)
- t = summary.testMap.get(fullname)
- if not t:
- continue
- current = runSamples.get(t.id)
- prev = prevSamples.get(t.id)
- if not current or not prev:
- continue
- current = current[0]
- prev = prev[0]
- pct = safediv(current, prev)
- if pct is None:
- continue
- pctDelta = pct - 1.
- if abs(pctDelta) < .05:
- continue
- if min(prev,current) <= .2:
- continue
- deltas.append( (t.id, testName, current, prev, pctDelta) )
-
- hidden = len(deltas) == 0
- """
- <p>
- <a href="javascript://" onclick="toggleLayer('%s')"; id="%s_">(%s) %d %s Significant Changes</a>
- <div id="%s" style="display: %s;" class="hideable">
- """ % (name, name, ("+","-")[hidden], len(deltas), name, name, ("","none")[hidden])
- if deltas:
- # Redirect or something so we don't have to specify
- # run here; that is silly.
- """
- <form method="GET" action="graphSingle">
- <input type="hidden" name="run" value="%d">
- <input type="hidden" name="kind" value="%d">
- <form method="GET" action="graphSingle">
- <table class="sortable" border=1>
- <thead>
- <tr>
- <th class="sorttable_nosort"><input type="checkbox" id="checkAll.%d"></th>
- <th>Program</th>
- <th>%% Change</th>
- <th>Previous Value</th>
- <th>Current Value</th>
- </tr>
- </thead>
- """ % (run.id, i, i,)
- for id, name, current, prev, pctDelta in deltas:
- """
- <tr>
- <td><input type="checkbox" name="cb.%d" id="cb_group.%d"></td>
- <td><a href="../programs/%s/">%s</a></td>
- %s
- <td>%s</td>
- <td>%s</td>
- </tr>
- """ % (id, i, id, name,
- Util.PctCell(pctDelta).render(), prev, current)
- """
- </table>
- <input type="submit" value="Compare Values">
- </form>
- """
-
- """
- </div>
- """
-
- def graphSingle [html] (self):
- request = quixote.get_request()
- full = request.form.get('full', '')
- allResults = not not full
-
- # Get a DB connection.
- db = self.root.getDB()
-
- run = self.getActiveRun(db)
- runs = db.runs(run.machine).order_by(Run.start_time.desc()).all()
- machine = run.machine
-
- request = quixote.get_request()
- kindStr = request.form.get('kind')
- kind = None
- try:
- kind = kComparisonKinds[int(kindStr)]
- except:
- pass
- tests = []
- for name,value in request.form.items():
- if name.startswith(str('cb.')):
- testIDStr = name[3:]
- try:
- testID = int(str(testIDStr))
- tests.append(db.getTest(testID))
- except:
- pass
-
- # Collect samples by test and machine, then bin into runs.
- samplesByTest = {}
- for t in tests:
- samples = samplesByTest[t.id] = samplesByTest.get(t.id,{})
-
- q = db.session.query(Sample.run_id,
- Sample.value).join(Run)
- q = q.filter(Run.machine_id == machine.id)
- q = q.filter(Sample.test_id == t.id)
- for s_run_id,s_value in q:
- samples[s_run_id] = s_value
-
- legend = []
- plots = ""
- for i,test in enumerate(tests):
- data = []
- for run in runs:
- value = samplesByTest.get(test.id,{}).get(run.id)
- if value is not None:
- timeval = time.mktime(run.start_time.timetuple())
- data.append((timeval, value))
- data.sort()
-
- col = list(Util.makeDarkColor(float(i) / len(tests)))
- pts = ','.join(['[%f,%f]' % (t,v) for t,v in data])
- style = "new Graph2D_LinePlotStyle(1, %r)" % col
- plots += " graph.addPlot([%s], %s);\n" % (pts,style)
-
- legend.append((test.name.split(str('.'),1)[1], col))
- graph_init = """\
- function init() {
- graph = new Graph2D("graph");
- graph.clearColor = [1, 1, 1];
- %s
- graph.xAxis.format = graph.xAxis.formats.day;
- graph.draw();
- }
- """ % (plots,)
-
- self.root.getHeader("Results Graph", "../..",
- components=(('nightlytest','nightlytest'),
- ('machine',
- 'nightlytest/machines/%d'%machine.id),
- ('run', 'nightlytest/%d' % run.id)),
- addPopupJS=True, addGraphJS=True,
- addJSScript=graph_init,
- onload='init()')
-
- # Graph2D based graph.
- """
- <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"> </td><td>%s</td></tr>""" % (
- 255*col[0], 255*col[1], 255*col[2], name)
- """
- </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>
- """
-
- """<h3>Values</h3>
- <a href="javascript://" onclick="toggleLayer('graph_values');"
- id="graph_values_">(-) Graph Values</a>
- <div id="graph_values" style="display: none;" class="hideable">
- <table class="sortable" border=1>
- <thead>
- <tr>
- <th>Run</th>
- <th>Timestamp</th>
- """
- for t in tests:
- """
- <th>%s</th>
- """ % (t.name,)
- """
- </thead>
- """
-
- for run in runs:
- """
- <tr>
- <td>%d</td>
- <td>%s</td>""" % (run.id, run.start_time)
- for t in tests:
- value = samplesByTest.get(t.id,{}).get(run.id, 'N/A')
- """
- <td>%s</td>""" % value
- """
- </tr>"""
- """
- </table>
- </div>
- """
-
- self.root.getFooter()
-
-class NightlyTestProgramUI(Directory):
- _q_exports = [""]
-
- def __init__(self, root, testIDStr):
- self.root = root
- try:
- self.testID = int(testIDStr)
- except ValueError, exc:
- raise TraversalError(str(exc))
-
- def _q_index [html] (self):
- # Get a DB connection.
- db = self.root.getDB()
-
- # Get the test we use to derive the name.
- t = db.getTest(id = self.testID)
- programName = t.name.split(str('.'), 3)[1]
-
- self.root.getHeader("Program: %s" % programName, "../../..",
- components=(('nightlytest','nightlytest'),),
- addPopupJS=True)
-
- # Collect runs within the last 48 hours of the most recent report.
- import datetime
- runs = []
- most_recent, = db.session.query(Run.start_time).\
- order_by(Run.start_time.desc()).first()
- cutoff = most_recent - datetime.timedelta(days=2)
- runs = db.session.query(Run).\
- filter(Run.start_time >= cutoff).\
- order_by(Run.start_time.desc()).all()
-
- self.getAllResults(db, programName, runs)
-
- self.root.getFooter()
-
- def getAllResults [html] (self, db, testName, runs):
- columns = [('GCCAS', 'gcc.compile.time', ()),
- ('Bitcode','bc.compile.size', ()),
- ('LLC<br>compile','llc.compile.time', ('bc.compile.size',)),
- ('LLC-BETA<br>compile','llc-beta.compile.time',
- ('bc.compile.size',)),
- ('JIT<br>codegen','jit.compile.time', ('bc.compile.size',)),
- ('GCC','gcc.exec.time', ('gcc.compile.time',)),
- ('CBE','cbe.exec.time', ('bc.compile.size',)),
- ('LLC','llc.exec.time', ('llc.compile.time',)),
- ('LLC-BETA','llc-beta.exec.time', ('llc-beta.compile.time',)),
- ('JIT','jit.exec.time', ('jit.compile.time',))]
-
- # Add interface to hiding columns by test or column type.
- keyIndices = Util.multidict()
- for idx,info in enumerate(columns):
- key = str(info[1]).split(str('.'))[0]
- keyIndices[key] = idx + 2
- """
- <form>
- <table border="1">
- <thead>
- <tr>
- <th>Column Visibility</th>
- <th>GCC</th>
- <th>LLC</th>
- <th>CBE</th>
- <th>JIT</th>
- <th>LLC-BETA</th>
- </tr>
- </thead>
- <tr>
- <td>Enabled</td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- <td><input type='checkbox' onClick='javascript:show_hide_column("programs", [%s]);' checked></td>
- </tr>
- </table>
- </form>
- """ % (', '.join(map(str, keyIndices['gcc'])),
- ', '.join(map(str, keyIndices['llc'])),
- ', '.join(map(str, keyIndices['cbe'])),
- ', '.join(map(str, keyIndices['jit'])),
- ', '.join(map(str, keyIndices['llc-beta'])))
-
- # The main table.
- """
- <table class="sortable" border="1" cellspacing="0" cellpadding="0" id="programs">
- <thead>
- <tr>
- <th>Machine</th>
- <th>Run Start</th>
- """
- for name,key,dependsOn in columns:
- """<th>%s</th>""" % (name, )
- """
- </tr>
- </thead>
- """
-
- for run in runs:
- """
- <tr>
- <td><a href="../../machines/%d">%s:%d</a></td>
- <td><a href="../../%d">%s</a></td>
- """ % (run.machine.id, run.machine.name, run.machine.number,
- run.id, run.start_time)
-
- for name,key,dependsOn in columns:
- fullname = str('nightlytest.' + testName + '.' + key)
- # FIXME: Make fast.
- current = getTestNameValueInRun(db, run, fullname)
- if current is not None:
- if key.endswith('size'):
- """<td>%d</td>""" % int(current)
- else:
- """<td>%.4f</td>""" % current
- else:
- # Only mark failure if nothing we depend on failed.
- failed = True
- for d in dependsOn:
- # FIXME: Make fast.
- t = getTestNameValueInRun(db, run,
- str('nightlytest.' + testName
- + '.' + d))
- if t is None:
- failed = False
- break
- if failed:
- """<td bgcolor="#FF0000">*</td>"""
- else:
- """<td>N/A</td>"""
- """
- </tr>
- """
- """
- </table>
- """
-
-class NightlyTestDirectory(NTStyleBrowser.RecentMachineDirectory):
- _q_exports = [""]
-
- def getTags(self):
- return (None, 'nightlytest')
-
- def getTestRunUI(self, component):
- return NightlyTestRunUI(self.root, component)
-
- def getProgramUI(self, component):
- return NightlyTestProgramUI(self.root, component)
Removed: zorg/trunk/lnt/lnt/viewer/resources/form.css
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/resources/form.css?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/resources/form.css (original)
+++ zorg/trunk/lnt/lnt/viewer/resources/form.css (removed)
@@ -1,75 +0,0 @@
-/* Derived from Quixote's BASIC_FORM_CSS */
-
-form.quixote div.title {
- font-weight: bold;
-}
-
-form.quixote br.submit,
-form.quixote br.widget,
-br.quixoteform {
- clear: left;
-}
-
-form.quixote div.submit br.widget {
- display: none;
-}
-
-form.quixote div.widget {
- float: left;
- padding: 4px;
- padding-right: 1em;
- margin-bottom: 6px;
-}
-
-/* pretty forms (attribute selector hides from broken browsers (e.g. IE) */
-form.quixote[action] {
- float: left;
-}
-
-form.quixote[action] > div.widget {
- float: none;
-}
-
-form.quixote[action] > br.widget {
- display: none;
-}
-
-form.quixote div.widget div.widget {
- padding: 0;
- margin-bottom: 0;
-}
-
-form.quixote div.SubmitWidget {
- float: left
-}
-
-form.quixote div.content {
- margin-left: 0.6em; /* indent content */
-}
-
-form.quixote div.content div.content {
- margin-left: 0; /* indent content only for top-level widgets */
-}
-
-form.quixote div.error {
- color: #c00;
- font-size: small;
- margin-top: .1em;
-}
-
-form.quixote div.hint {
- font-size: small;
- font-style: italic;
- margin-top: .1em;
-}
-
-form.quixote div.errornotice {
- color: #c00;
- padding: 0.5em;
- margin: 0.5em;
-}
-
-form.quixote div.FormTokenWidget,
-form.quixote.div.HiddenWidget {
- display: none;
-}
Removed: zorg/trunk/lnt/lnt/viewer/resources/popup.js
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/resources/popup.js?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/resources/popup.js (original)
+++ zorg/trunk/lnt/lnt/viewer/resources/popup.js (removed)
@@ -1,155 +0,0 @@
-function ShowPop(id)
-{
- if (document.getElementById)
- {
- document.getElementById(id).style.visibility = " visible";
- }
- else if (document.all)
- {
- document.all[id].style.visibility = " visible";
- }
- else if (document.layers)
- {
- document.layers[id].style.visibility = " visible";
- }
-}
-
-
-
-
-
-
-function HidePop(id)
-{
- if (document.getElementById)
- {
- document.getElementById(id).style.visibility = " hidden";
- }
- /*else if (document.all)
- {
- document.all[id].style.visibility = " hidden";
- }
- else if (document.layers)
- {
- document.layers[id].style.visibility = " hidden";
- }*/
-}
-
-
-
-function TogglePop(id)
-{
- if (document.getElementById)
- {
- if(document.getElementById(id).style.visibility == "visible"){
- document.getElementById(id).style.visibility = "hidden";
- }
- else{
- document.getElementById(id).style.visibility = "visible";
- }
- }
- else if (document.all)
- {
- if(document.all[id].style.visibility == "visible"){
- document.all[id].style.visibility = "hidden";
- }
- else{
- document.all[id].style.visibility = "visible";
- }
- }
- else if (document.layers)
- {
- if(document.layers[id].style.visibility == "visible"){
- document.layers[id].style.visibility = "hidden";
- }
- else{
- document.layers[id].style.visibility = "visible";
- }
- }
-}
-
-
-function toggleLayer(whichLayer)
-{
- if (document.getElementById)
- {
- // this is the way the standards work
- var style2 = document.getElementById(whichLayer).style;
- style2.display = style2.display? "":"none";
- var link = document.getElementById(whichLayer+"_").innerHTML;
- if(link.indexOf("(+)") >= 0){
- document.getElementById(whichLayer+"_").innerHTML="(-)"+link.substring(3,link.length);
- }
- else{
- document.getElementById(whichLayer+"_").innerHTML="(+)"+link.substring(3,link.length);
- }
- }//end if
- else if (document.all)
- {
- // this is the way old msie versions work
- var style2 = document.all[whichLayer].style;
- style2.display = style2.display? "":"none";
- var link = document.all[wwhichLayer+"_"].innerHTML;
- if(link.indexOf("(+)") >= 0){
- document.all[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length);
- }
- else{
- document.all[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length);
- }
- }
- else if (document.layers)
- {
- // this is the way nn4 works
- var style2 = document.layers[whichLayer].style;
- style2.display = style2.display? "":"none";
- var link = document.layers[whichLayer+"_"].innerHTML;
- if(link.indexOf("(+)") >= 0){
- document.layers[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length);
- }
- else{
- document.layers[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length);
- }
- }
-}//end function
-
-var checkflag="false";
-function check(field) {
- if (checkflag == "false") {
- for (i = 0; i < field.length; i++) {
- field[i].checked = true;
- }
- checkflag = "true";
- return "Uncheck all";
- }
- else {
- for (i = 0; i < field.length; i++) {
- if(field[i].type == 'checkbox'){
- field[i].checked = false;
- }
- }
- checkflag = "false";
- return "Check all";
- }
-}
-
-function show_hide_column(tableName, columns) {
- // Let's be clear hear, I have no idea how to write portable
- // JavaScript. This works in Safari, yo.
- var event = window.event;
- var cb = event.target;
-
- var style = cb.checked ? "table-cell" : "none";
-
- var tbl = document.getElementById(tableName);
- var rows = tbl.getElementsByTagName('tr');
-
- for (var row = 0; row < rows.length; ++row) {
- var cells = rows[row].getElementsByTagName('td');
-
- if (cells.length == 0)
- cells = rows[row].getElementsByTagName('th');
-
- for (var i = 0; i < columns.length; ++i)
- cells[columns[i]].style.display = style;
- }
-}
Removed: zorg/trunk/lnt/lnt/viewer/resources/sorttable.js
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/resources/sorttable.js?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/resources/sorttable.js (original)
+++ zorg/trunk/lnt/lnt/viewer/resources/sorttable.js (removed)
@@ -1,500 +0,0 @@
-/*
- SortTable
- version 2
- 7th April 2007
- Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
-
- Instructions:
- Download this file
- Add <script src="sorttable.js"></script> to your HTML
- Add class="sortable" to any table you'd like to make sortable
- Click on the headers to sort
-
- Thanks to many, many people for contributions and suggestions.
- Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
- This basically means: do what you want with it.
-*/
-
-
-var stIsIE = /*@cc_on!@*/false;
-
-sorttable = {
- init: function() {
- // quit if this function has already been called
- if (arguments.callee.done) return;
- // flag this function so we don't do the same thing twice
- arguments.callee.done = true;
- // kill the timer
- if (_timer) clearInterval(_timer);
-
- if (!document.createElement || !document.getElementsByTagName) return;
-
- sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
-
- forEach(document.getElementsByTagName('table'), function(table) {
- if (table.className.search(/\bsortable\b/) != -1) {
- sorttable.makeSortable(table);
- }
- });
-
- },
-
- makeSortable: function(table) {
- if (table.getElementsByTagName('thead').length == 0) {
- // table doesn't have a tHead. Since it should have, create one and
- // put the first table row in it.
- the = document.createElement('thead');
- the.appendChild(table.rows[0]);
- table.insertBefore(the,table.firstChild);
- }
- // Safari doesn't support table.tHead, sigh
- if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
-
- //DWD: if (table.tHead.rows.length != 1) return; // can't cope with two header rows
-
-
- // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
- // "total" rows, for example). This is B&R, since what you're supposed
- // to do is put them in a tfoot. So, if there are sortbottom rows,
- // for backwards compatibility, move them to tfoot (creating it if needed).
- sortbottomrows = [];
- for (var i=0; i<table.rows.length; i++) {
- if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
- sortbottomrows[sortbottomrows.length] = table.rows[i];
- }
- }
- if (sortbottomrows) {
- if (table.tFoot == null) {
- // table doesn't have a tfoot. Create one.
- tfo = document.createElement('tfoot');
- table.appendChild(tfo);
- }
- for (var i=0; i<sortbottomrows.length; i++) {
- tfo.appendChild(sortbottomrows[i]);
- }
- delete sortbottomrows;
- }
-
- // work through each column and calculate its type
- for (var j=0; j<table.tHead.rows.length; j++) {
- headrow = table.tHead.rows[j].cells;
- for (var i=0; i<headrow.length; i++) {
- // manually override the type with a sorttable_type attribute
- if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
- mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
- if (mtch) { override = mtch[1]; }
- if (mtch && typeof sorttable["sort_"+override] == 'function') {
- headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
- } else {
- headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
- }
- // make it clickable to sort
- var index = i;
- if (headrow[i].getAttribute("sorttable_index") != null)
- index = headrow[i].getAttribute("sorttable_index");
-
- headrow[i].sorttable_columnindex = index;
- headrow[i].sorttable_tbody = table.tBodies[0];
- dean_addEvent(headrow[i],"click", function(e) {
-
- if (this.className.search(/\bsorttable_sorted\b/) != -1) {
- // if we're already sorted by this column, just
- // reverse the table, which is quicker
- sorttable.reverse(this.sorttable_tbody);
- this.className = this.className.replace('sorttable_sorted',
- 'sorttable_sorted_reverse');
- this.removeChild(document.getElementById('sorttable_sortfwdind'));
- sortrevind = document.createElement('span');
- sortrevind.id = "sorttable_sortrevind";
- sortrevind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▴';
- this.appendChild(sortrevind);
- return;
- }
- if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
- // if we're already sorted by this column in reverse, just
- // re-reverse the table, which is quicker
- sorttable.reverse(this.sorttable_tbody);
- this.className = this.className.replace('sorttable_sorted_reverse',
- 'sorttable_sorted');
- this.removeChild(document.getElementById('sorttable_sortrevind'));
- sortfwdind = document.createElement('span');
- sortfwdind.id = "sorttable_sortfwdind";
- sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
- this.appendChild(sortfwdind);
- return;
- }
-
- // remove sorttable_sorted classes
- forEach(table.tHead.rows, function(row) {
- forEach(row.childNodes, function(cell) {
- if (cell.nodeType == 1) { // an element
- cell.className = cell.className.replace('sorttable_sorted_reverse','');
- cell.className = cell.className.replace('sorttable_sorted','');
- }
- })});
- sortfwdind = document.getElementById('sorttable_sortfwdind');
- if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
- sortrevind = document.getElementById('sorttable_sortrevind');
- if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
-
- this.className += ' sorttable_sorted';
- sortfwdind = document.createElement('span');
- sortfwdind.id = "sorttable_sortfwdind";
- sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
- this.appendChild(sortfwdind);
-
- // build an array to sort. This is a Schwartzian transform thing,
- // i.e., we "decorate" each row with the actual sort key,
- // sort based on the sort keys, and then put the rows back in order
- // which is a lot faster because you only do getInnerText once per row
- row_array = [];
- col = this.sorttable_columnindex;
- rows = this.sorttable_tbody.rows;
- for (var j=0; j<rows.length; j++) {
- row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
- }
- /* If you want a stable sort, uncomment the following line */
- //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
- /* and comment out this one */
- row_array.sort(this.sorttable_sortfunction);
-
- tb = this.sorttable_tbody;
- for (var j=0; j<row_array.length; j++) {
- tb.appendChild(row_array[j][1]);
- }
-
- delete row_array;
- });
- }
- }
- }
- },
-
- guessType: function(table, column) {
- // guess the type of a column based on its first non-blank row
- sortfn = sorttable.sort_alpha;
- for (var i=0; i<table.tBodies[0].rows.length; i++) {
- text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
- if (text != '') {
- if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
- return sorttable.sort_numeric;
- }
- // check for a date: dd/mm/yyyy or dd/mm/yy
- // can have / or . or - as separator
- // can be mm/dd as well
- possdate = text.match(sorttable.DATE_RE)
- if (possdate) {
- // looks like a date
- first = parseInt(possdate[1]);
- second = parseInt(possdate[2]);
- if (first > 12) {
- // definitely dd/mm
- return sorttable.sort_ddmm;
- } else if (second > 12) {
- return sorttable.sort_mmdd;
- } else {
- // looks like a date, but we can't tell which, so assume
- // that it's dd/mm (English imperialism!) and keep looking
- sortfn = sorttable.sort_ddmm;
- }
- }
- }
- }
- return sortfn;
- },
-
- getInnerText: function(node) {
- // gets the text we want to use for sorting for a cell.
- // strips leading and trailing whitespace.
- // this is *not* a generic getInnerText function; it's special to sorttable.
- // for example, you can override the cell text with a customkey attribute.
- // it also gets .value for <input> fields.
-
- hasInputs = (typeof node.getElementsByTagName == 'function') &&
- node.getElementsByTagName('input').length;
-
- if (node.getAttribute("sorttable_customkey") != null) {
- return node.getAttribute("sorttable_customkey");
- }
- else if (typeof node.textContent != 'undefined' && !hasInputs) {
- return node.textContent.replace(/^\s+|\s+$/g, '');
- }
- else if (typeof node.innerText != 'undefined' && !hasInputs) {
- return node.innerText.replace(/^\s+|\s+$/g, '');
- }
- else if (typeof node.text != 'undefined' && !hasInputs) {
- return node.text.replace(/^\s+|\s+$/g, '');
- }
- else {
- switch (node.nodeType) {
- case 3:
- if (node.nodeName.toLowerCase() == 'input') {
- return node.value.replace(/^\s+|\s+$/g, '');
- }
- case 4:
- return node.nodeValue.replace(/^\s+|\s+$/g, '');
- break;
- case 1:
- case 11:
- var innerText = '';
- for (var i = 0; i < node.childNodes.length; i++) {
- innerText += sorttable.getInnerText(node.childNodes[i]);
- }
- return innerText.replace(/^\s+|\s+$/g, '');
- break;
- default:
- return '';
- }
- }
- },
-
- reverse: function(tbody) {
- // reverse the rows in a tbody
- newrows = [];
- for (var i=0; i<tbody.rows.length; i++) {
- newrows[newrows.length] = tbody.rows[i];
- }
- for (var i=newrows.length-1; i>=0; i--) {
- tbody.appendChild(newrows[i]);
- }
- delete newrows;
- },
-
- /* sort functions
- each sort function takes two parameters, a and b
- you are comparing a[0] and b[0] */
- sort_numeric: function(a,b) {
- aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
- if (isNaN(aa)) aa = 0;
- bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
- if (isNaN(bb)) bb = 0;
- return aa-bb;
- },
- sort_alpha: function(a,b) {
- if (a[0]==b[0]) return 0;
- if (a[0]<b[0]) return -1;
- return 1;
- },
- sort_ddmm: function(a,b) {
- mtch = a[0].match(sorttable.DATE_RE);
- y = mtch[3]; m = mtch[2]; d = mtch[1];
- if (m.length == 1) m = '0'+m;
- if (d.length == 1) d = '0'+d;
- dt1 = y+m+d;
- mtch = b[0].match(sorttable.DATE_RE);
- y = mtch[3]; m = mtch[2]; d = mtch[1];
- if (m.length == 1) m = '0'+m;
- if (d.length == 1) d = '0'+d;
- dt2 = y+m+d;
- if (dt1==dt2) return 0;
- if (dt1<dt2) return -1;
- return 1;
- },
- sort_mmdd: function(a,b) {
- mtch = a[0].match(sorttable.DATE_RE);
- y = mtch[3]; d = mtch[2]; m = mtch[1];
- if (m.length == 1) m = '0'+m;
- if (d.length == 1) d = '0'+d;
- dt1 = y+m+d;
- mtch = b[0].match(sorttable.DATE_RE);
- y = mtch[3]; d = mtch[2]; m = mtch[1];
- if (m.length == 1) m = '0'+m;
- if (d.length == 1) d = '0'+d;
- dt2 = y+m+d;
- if (dt1==dt2) return 0;
- if (dt1<dt2) return -1;
- return 1;
- },
-
- shaker_sort: function(list, comp_func) {
- // A stable sort function to allow multi-level sorting of data
- // see: http://en.wikipedia.org/wiki/Cocktail_sort
- // thanks to Joseph Nahmias
- var b = 0;
- var t = list.length - 1;
- var swap = true;
-
- while(swap) {
- swap = false;
- for(var i = b; i < t; ++i) {
- if ( comp_func(list[i], list[i+1]) > 0 ) {
- var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
- swap = true;
- }
- } // for
- t--;
-
- if (!swap) break;
-
- for(var i = t; i > b; --i) {
- if ( comp_func(list[i], list[i-1]) < 0 ) {
- var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
- swap = true;
- }
- } // for
- b++;
-
- } // while(swap)
- }
-}
-
-/* ******************************************************************
- Supporting functions: bundled here to avoid depending on a library
- ****************************************************************** */
-
-// Dean Edwards/Matthias Miller/John Resig
-
-/* for Mozilla/Opera9 */
-if (document.addEventListener) {
- document.addEventListener("DOMContentLoaded", sorttable.init, false);
-}
-
-/* for Internet Explorer */
-/*@cc_on @*/
-/*@if (@_win32)
- document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
- var script = document.getElementById("__ie_onload");
- script.onreadystatechange = function() {
- if (this.readyState == "complete") {
- sorttable.init(); // call the onload handler
- }
- };
-/*@end @*/
-
-/* for Safari */
-if (/WebKit/i.test(navigator.userAgent)) { // sniff
- var _timer = setInterval(function() {
- if (/loaded|complete/.test(document.readyState)) {
- sorttable.init(); // call the onload handler
- }
- }, 10);
-}
-
-/* for other browsers */
-window.onload = sorttable.init;
-
-// written by Dean Edwards, 2005
-// with input from Tino Zijdel, Matthias Miller, Diego Perini
-
-// http://dean.edwards.name/weblog/2005/10/add-event/
-
-function dean_addEvent(element, type, handler) {
- if (element.addEventListener) {
- element.addEventListener(type, handler, false);
- } else {
- // assign each event handler a unique ID
- if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
- // create a hash table of event types for the element
- if (!element.events) element.events = {};
- // create a hash table of event handlers for each element/event pair
- var handlers = element.events[type];
- if (!handlers) {
- handlers = element.events[type] = {};
- // store the existing event handler (if there is one)
- if (element["on" + type]) {
- handlers[0] = element["on" + type];
- }
- }
- // store the event handler in the hash table
- handlers[handler.$$guid] = handler;
- // assign a global event handler to do all the work
- element["on" + type] = handleEvent;
- }
-};
-// a counter used to create unique IDs
-dean_addEvent.guid = 1;
-
-function removeEvent(element, type, handler) {
- if (element.removeEventListener) {
- element.removeEventListener(type, handler, false);
- } else {
- // delete the event handler from the hash table
- if (element.events && element.events[type]) {
- delete element.events[type][handler.$$guid];
- }
- }
-};
-
-function handleEvent(event) {
- var returnValue = true;
- // grab the event object (IE uses a global event object)
- event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
- // get a reference to the hash table of event handlers
- var handlers = this.events[event.type];
- // execute each event handler
- for (var i in handlers) {
- this.$$handleEvent = handlers[i];
- if (this.$$handleEvent(event) === false) {
- returnValue = false;
- }
- }
- return returnValue;
-};
-
-function fixEvent(event) {
- // add W3C standard event methods
- event.preventDefault = fixEvent.preventDefault;
- event.stopPropagation = fixEvent.stopPropagation;
- return event;
-};
-fixEvent.preventDefault = function() {
- this.returnValue = false;
-};
-fixEvent.stopPropagation = function() {
- this.cancelBubble = true;
-}
-
-// Dean's forEach: http://dean.edwards.name/base/forEach.js
-/*
- forEach, version 1.0
- Copyright 2006, Dean Edwards
- License: http://www.opensource.org/licenses/mit-license.php
-*/
-
-// array-like enumeration
-if (!Array.forEach) { // mozilla already supports this
- Array.forEach = function(array, block, context) {
- for (var i = 0; i < array.length; i++) {
- block.call(context, array[i], i, array);
- }
- };
-}
-
-// generic enumeration
-Function.prototype.forEach = function(object, block, context) {
- for (var key in object) {
- if (typeof this.prototype[key] == "undefined") {
- block.call(context, object[key], key, object);
- }
- }
-};
-
-// character enumeration
-String.forEach = function(string, block, context) {
- Array.forEach(string.split(""), function(chr, index) {
- block.call(context, chr, index, string);
- });
-};
-
-// globally resolve forEach enumeration
-var forEach = function(object, block, context) {
- if (object) {
- var resolve = Object; // default
- if (object instanceof Function) {
- // functions have a "length" property
- resolve = Function;
- } else if (object.forEach instanceof Function) {
- // the object implements a custom forEach method so use that
- object.forEach(block, context);
- return;
- } else if (typeof object == "string") {
- // the object is a string
- resolve = String;
- } else if (typeof object.length == "number") {
- // the object is array-like
- resolve = Array;
- }
- resolve.forEach(object, block, context);
- }
-};
-
Removed: zorg/trunk/lnt/lnt/viewer/resources/style.css
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/resources/style.css?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/resources/style.css (original)
+++ zorg/trunk/lnt/lnt/viewer/resources/style.css (removed)
@@ -1,79 +0,0 @@
-.zorg_navheader {
- background-color: #cccccc;
-}
-
-body {
- color:#000000;
- background-color:#ffffff
-}
-
-body {
- font-family: Helvetica, sans-serif;
- font-size:9pt
-}
-
-h1 {
- font-size: 14pt;
-}
-
-h2 {
- font-size: 12pt;
-}
-
-table {
- font-size:9pt
-}
-
-table {
- border-spacing: 0px;
- border: 1px solid black
-}
-
-th, table thead {
- background-color:#eee;
- color:#666666;
- font-weight: bold;
- cursor: default;
- text-align:center;
- font-weight: bold;
- font-family: Verdana;
-}
-
-.W {
- font-size:0px
-}
-
-th, td {
- padding:5px;
- padding-left:8px;
-}
-
-tbody.scrollContent {
- overflow:auto
-}
-
-.hideable {
- border-width:thin;
- border-color:background;
- border-style:solid;
- background: #F8F8FF;
- padding:8px;
-}
-
-/* Nested popups */
-
-.hideable_1 {
- border-width:thin;
- border-color:background;
- border-style:solid;
- background: #F8F8FF;
- padding:8px;
-}
-
-.hideable_2 {
- border-width:thin;
- border-color:background;
- border-style:solid;
- background: #E8E8E8;
- padding:8px;
-}
Removed: zorg/trunk/lnt/lnt/viewer/runs.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/runs.ptl?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/runs.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/runs.ptl (removed)
@@ -1,84 +0,0 @@
-# -*- python -*-
-
-"""
-Generic run browsing UI.
-"""
-
-import sys
-from quixote import get_response, redirect
-from quixote.directory import Directory
-from quixote.errors import TraversalError
-
-class RunUI(Directory):
- _q_exports = [""]
-
- def __init__(self, root, idstr):
- self.root = root
- try:
- self.id = int(idstr)
- except ValueError, exc:
- raise TraversalError(str(exc))
-
- def _q_index [html] (self):
- # Get a DB connection.
- db = self.root.getDB()
-
- r = db.getRun(self.id)
- m = db.getMachine(r.machine_id)
-
- self.root.getHeader("Run: %s" % r.id, '../..',
- components=(('browse','browse'),))
-
- """
- <table border=1 cellborder=1>
- <tr>
- <th>Machine</th>
- <th>Start Time</th>
- <th>End Time</th>
- </tr>
- </thead>
- <tr>
- <td><a href="../../machines/%d/">%s:%d</a></td>
- <td>%s</td>
- <td>%s</td>
- </tr>
- </table>
- """ % (r.machine_id, m.name, m.number, r.start_time, r.end_time)
-
-
- # Show the run info dictionary.
- """
- <h3>Run Info</h3>
- <table border=1 cellborder=1>
- <tr>
- <th>Key</th>
- <th>Value</th>
- </tr>
- </thead>
- """
- for mi in r.info.values():
- """
- <tr>
- <td>%s</td>
- <td>%s</td>
- </tr>""" % (mi.key, mi.value)
- """
- </table>
- """
-
- self.root.getFooter()
-
-class RunsDirectory(Directory):
- _q_exports = [""]
-
- def __init__(self, root):
- Directory.__init__(self)
- self.root = root
-
- def _q_index [plain] (self):
- """
- run access
- """
-
- def _q_lookup(self, component):
- return RunUI(self.root, component)
Removed: zorg/trunk/lnt/lnt/viewer/tests.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/tests.ptl?rev=146404&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/tests.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/tests.ptl (removed)
@@ -1,88 +0,0 @@
-# -*- python -*-
-
-"""
-Generic test browsing UI.
-"""
-
-import sys
-from quixote import get_response, redirect
-from quixote.directory import Directory
-from quixote.errors import TraversalError
-
-class TestUI(Directory):
- _q_exports = [""]
-
- def __init__(self, root, idstr):
- self.root = root
- try:
- self.id = int(idstr)
- except ValueError, exc:
- raise TraversalError(str(exc))
-
- def _q_index [html] (self):
- # Get a DB connection.
- db = self.root.getDB()
-
- t = db.getTest(self.id)
-
- self.root.getHeader("Test: %s" % t.name, '../..',
- components=(('browse','browse'),))
-
- # Show the test info dictionary.
- """
- <h3>Test Info</h3>
- <table border=1 cellborder=1>
- <tr>
- <th>Key</th>
- <th>Value</th>
- </tr>
- </thead>
- """
- for item in t.info.values():
- """
- <tr>
- <td>%s</td>
- <td>%s</td>
- </tr>""" % (item.key, item.value)
- """
- </table>
- """
-
- # List samples.
- """
- <h3>Associated Samples</h3>
- <table class="sortable" border=1 cellborder=1>
- <thead>
- <tr>
- <th>Run ID</th>
- <th>Value</th>
- </tr>
- </thead>
- """
- for s in db.samples(test=t):
- """
- <tr>
- <td><a href="../../runs/%d/">%d</a></td>
- <td>%s</td>
- </tr>
- """ % (s.run_id, s.run_id, s.value)
- """
- </table>
- """
-
- self.root.getFooter()
-
-class TestsDirectory(Directory):
- _q_exports = [""]
-
- def __init__(self, root):
- Directory.__init__(self)
- self.root = root
-
- def _q_index [plain] (self):
- """
- test access
- """
-
- def _q_lookup(self, component):
- return TestUI(self.root, component)
More information about the llvm-commits
mailing list