[LNT] r185862 - Update graphing display to allow the display of non-integer revision numbers.
Chris Matthews
cmatthews5 at apple.com
Mon Jul 8 13:41:17 PDT 2013
Author: cmatthews
Date: Mon Jul 8 15:41:17 2013
New Revision: 185862
URL: http://llvm.org/viewvc/llvm-project?rev=185862&view=rev
Log:
Update graphing display to allow the display of non-integer revision numbers.
Modified:
lnt/trunk/lnt/server/ui/templates/v4_graph.html
lnt/trunk/lnt/server/ui/views.py
Modified: lnt/trunk/lnt/server/ui/templates/v4_graph.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_graph.html?rev=185862&r1=185861&r2=185862&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_graph.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_graph.html Mon Jul 8 15:41:17 2013
@@ -63,7 +63,7 @@ function init() {
// Add tooltips.
graph.bind("plothover", function(e,p,i) {
- update_tooltip(e, p, i, show_tooltip); });
+ update_tooltip(e, p, i, show_tooltip, graph_plots); });
// Set up the overview graph.
var overview = $("#overview")
@@ -101,11 +101,25 @@ function init() {
// Show our overlay tooltip.
g.current_tip_point = null;
-function show_tooltip(x, y, item, pos) {
+function show_tooltip(x, y, item, pos, graph_data) {
+
+ // Given the event handler item, get the graph metadata.
+ function extract_metadata(item, graph_data) {
+ var index = item.dataIndex;
+ var series_index = item.seriesIndex;
+ // Graph data is formatted as [x, y, meta_data].
+ var meta_data = graph_data[series_index].data[index][2];
+ return meta_data;
+
+ }
var data = item.datapoint;
+ var meta_data = extract_metadata(item, graph_data);
var tip_body = '<div id="tooltip">';
- tip_body += "<b>Revision:</b>" + data[0].toFixed(0) + "<br>";
- tip_body += "<b>Value:</b>" + data[1].toFixed(4) + "s" + "</div>";
+ console.log(data)
+ if ("label" in meta_data) {
+ tip_body += "<b>Revision:</b>" + meta_data.label + "<br>";
+ }
+ tip_body += "<b>Value:</b>" + data[1].toFixed(4) + "</div>";
var tooltip_div = $(tip_body).css( {
position: 'absolute',
@@ -152,7 +166,7 @@ function update_tooltip(event, pos, item
g.current_tip_point[1] != item.datapoint[1])) {
$("#tooltip").remove();
g.current_tip_point = item.datapoint;
- show_fn(pos.pageX, pos.pageY, item, pos);
+ show_fn(pos.pageX, pos.pageY, item, pos, graph_data);
}
}
{% endblock %}
Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=185862&r1=185861&r2=185862&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Mon Jul 8 15:41:17 2013
@@ -27,6 +27,8 @@ import lnt.server.ui.util
import lnt.server.reporting.dailyreport
import lnt.server.reporting.summaryreport
+integral_rex = re.compile(r"[\d]+")
+
###
# Root-Only Routes
@@ -407,16 +409,6 @@ def v4_graph():
from lnt.util import stats
from lnt.external.stats import stats as ext_stats
- # FIXME: For now, we just do something stupid when we encounter release
- # numbers like '3.0.1' and use convert to 3. This makes the graphs
- # fairly useless...
- def convert_revision(r):
- if r.isdigit():
- return int(r)
- else:
- return int(r.split('.',1)[0])
- return r
-
ts = request.get_testsuite()
# Parse the view options.
@@ -444,6 +436,14 @@ def v4_graph():
request.args.get('hide_highlight'))
show_highlight = not options['hide_highlight']
+ def convert_revision(dotted):
+ """Turn a version number like 489.2.10 into something
+ that is ordered and sortable.
+ For now 489.2.10 will be returned as a tuple of ints.
+ """
+ dotted = integral_rex.findall(dotted)
+ return tuple([int(d) for d in dotted])
+
# Load the graph parameters.
graph_parameters = []
for name,value in request.args.items():
@@ -526,9 +526,8 @@ def v4_graph():
(field.status_field.column == None))
# Aggregate by revision.
- data = util.multidict((convert_revision(r),v)
- for v,r in q).items()
- data.sort()
+ data = util.multidict((rev, val) for val,rev in q).items()
+ data.sort(key=lambda sample: convert_revision(sample[0]))
# Compute the graph points.
errorbar_data = []
@@ -541,18 +540,24 @@ def v4_graph():
for _,values in data])
else:
normalize_by = 1.0
- for x, orig_values in data:
+ for pos, (point_label, orig_values) in enumerate(data):
+ metadata = {"label":point_label}
+ # on simple revisions use rev number for x else start from
+ # 0
+ rev_x = convert_revision(point_label)
+ x = rev_x if len(rev_x)==1 else pos
values = [v*normalize_by for v in orig_values]
min_value = min(values)
- pts.append((x, min_value))
+ pts.append((x, min_value, metadata))
# Add the individual points, if requested.
+ # For each point add a text label for the mouse over.
if show_all_points:
for v in values:
- points_data.append((x, v))
+ points_data.append((x, v, metadata))
elif show_points:
- points_data.append((x, min_value))
-
+ points_data.append((x, min_value, metadata))
+
# Add the standard deviation error bar, if requested.
if show_stddev:
mean = stats.mean(values)
@@ -605,8 +610,8 @@ def v4_graph():
# Add regression line, if requested.
if show_linear_regression:
- xs = [t for t,v in pts]
- ys = [v for t,v in pts]
+ xs = [t for t,v,_ in pts]
+ ys = [v for t,v,_ in pts]
# We compute the regression line in terms of a normalized X scale.
x_min, x_max = min(xs), max(xs)
More information about the llvm-commits
mailing list