Skip to content

Commit

Permalink
Update graphing display to allow the display of non-integer revision …
Browse files Browse the repository at this point in the history
…numbers.

git-svn-id: https://llvm.org/svn/llvm-project/lnt/trunk@185862 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Chris Matthews committed Jul 8, 2013
1 parent e6de719 commit 346300c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 25 deletions.
24 changes: 19 additions & 5 deletions lnt/server/ui/templates/v4_graph.html
Expand Up @@ -63,7 +63,7 @@

// 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")
Expand Down Expand Up @@ -101,11 +101,25 @@

// 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',
Expand Down Expand Up @@ -152,7 +166,7 @@
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 %}
Expand Down
45 changes: 25 additions & 20 deletions lnt/server/ui/views.py
Expand Up @@ -27,6 +27,8 @@
import lnt.server.reporting.dailyreport
import lnt.server.reporting.summaryreport

integral_rex = re.compile(r"[\d]+")

###
# Root-Only Routes

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -444,6 +436,14 @@ def convert_revision(r):
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():
Expand Down Expand Up @@ -526,9 +526,8 @@ def convert_revision(r):
(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 = []
Expand All @@ -541,18 +540,24 @@ def convert_revision(r):
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)
Expand Down Expand Up @@ -605,8 +610,8 @@ def compute_moving_average_and_median(x, window, average_list, median_list):

# 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)
Expand Down

0 comments on commit 346300c

Please sign in to comment.