@@ -24,18 +24,34 @@ function getColor(exe_id) {
24
24
. data ( 'color' ) ;
25
25
}
26
26
27
+ function scaleColorAlpha ( color , scale ) {
28
+ var c = $ . jqplot . getColorComponents ( color ) ;
29
+ c [ 3 ] = c [ 3 ] * scale ;
30
+ return 'rgba(' + c [ 0 ] + ', ' + c [ 1 ] + ', ' + c [ 2 ] + ', ' + c [ 3 ] + ')' ;
31
+ }
32
+
27
33
function shouldPlotEquidistant ( ) {
28
34
return $ ( "#equidistant" ) . is ( ':checked' ) ;
29
35
}
30
36
37
+ function shouldPlotQuartiles ( ) {
38
+ return $ ( "#show_quartile_bands" ) . is ( ':checked' ) ;
39
+ }
40
+
41
+ function shouldPlotExtrema ( ) {
42
+ return $ ( "#show_extrema_bands" ) . is ( ':checked' ) ;
43
+ }
44
+
31
45
function getConfiguration ( ) {
32
46
var config = {
33
47
exe : readCheckbox ( "input[name='executable']:checked" ) ,
34
48
base : $ ( "#baseline option:selected" ) . val ( ) ,
35
49
ben : $ ( "input[name='benchmark']:checked" ) . val ( ) ,
36
50
env : $ ( "input[name='environments']:checked" ) . val ( ) ,
37
51
revs : $ ( "#revisions option:selected" ) . val ( ) ,
38
- equid : $ ( "#equidistant" ) . is ( ':checked' ) ? "on" : "off"
52
+ equid : $ ( "#equidistant" ) . is ( ':checked' ) ? "on" : "off" ,
53
+ quarts : $ ( "#show_quartile_bands" ) . is ( ':checked' ) ? "on" : "off" ,
54
+ extr : $ ( "#show_extrema_bands" ) . is ( ':checked' ) ? "on" : "off"
39
55
} ;
40
56
41
57
var branch = readCheckbox ( "input[name='branch']:checked" ) ;
@@ -53,25 +69,89 @@ function permalinkToChanges(commitid, executableid, environment) {
53
69
function OnMarkerClickHandler ( ev , gridpos , datapos , neighbor , plot ) {
54
70
if ( $ ( "input[name='benchmark']:checked" ) . val ( ) === "grid" ) { return false ; }
55
71
if ( neighbor ) {
56
- var commitid = neighbor . data [ 3 ] ;
72
+ var commitid = neighbor . data [ neighbor . data . length - 2 ] ;
57
73
// Get executable ID from the seriesindex array
58
74
var executableid = seriesindex [ neighbor . seriesIndex ] ;
59
75
var environment = $ ( "input[name='environments']:checked" ) . val ( ) ;
60
76
permalinkToChanges ( commitid , executableid , environment ) ;
61
77
}
62
78
}
63
79
80
+ function getHighlighterConfig ( median ) {
81
+ if ( median ) {
82
+ return {
83
+ show : true ,
84
+ tooltipLocation : 'nw' ,
85
+ yvalues : 7 ,
86
+ formatString :'<table class="jqplot-highlighter"> <tr><td>date:</td><td>%s</td></tr> <tr><td>median:</td><td>%s</td></tr> <tr><td>max:</td><td>%s</td></tr> <tr><td>Q3:</td><td>%s</td></tr> <tr><td>Q1:</td><td>%s</td></tr> <tr><td>min:</td><td>%s</td></tr> <tr><td>commit:</td><td>%s</td></tr></table>'
87
+ } ;
88
+ } else {
89
+ return {
90
+ show : true ,
91
+ tooltipLocation : 'nw' ,
92
+ yvalues : 4 ,
93
+ formatString :'<table class="jqplot-highlighter"> <tr><td>date:</td><td>%s</td></tr> <tr><td>result:</td><td>%s</td></tr> <tr><td>std dev:</td><td>%s</td></tr> <tr><td>commit:</td><td>%s</td></tr></table>'
94
+ } ;
95
+ }
96
+ }
97
+
64
98
function renderPlot ( data ) {
65
99
var plotdata = [ ] ,
66
100
series = [ ] ,
67
101
lastvalues = [ ] ; //hopefully the smallest values for determining significant digits.
68
102
seriesindex = [ ] ;
103
+ var hiddenSeries = 0 ;
104
+ var median = data [ 'data_type' ] === 'M' ;
69
105
for ( var branch in data . branches ) {
70
106
// NOTE: Currently, only the "default" branch is shown in the timeline
71
107
for ( var exe_id in data . branches [ branch ] ) {
72
108
// FIXME if (branch !== "default") { label += " - " + branch; }
73
109
var label = $ ( "label[for*='executable" + exe_id + "']" ) . html ( ) ;
74
- series . push ( { "label" : label , "color" : getColor ( exe_id ) } ) ;
110
+ var seriesConfig = {
111
+ label : label ,
112
+ color : getColor ( exe_id )
113
+ } ;
114
+ if ( median ) {
115
+ $ ( "span.options.median" ) . css ( "display" , "inline" ) ;
116
+ var mins = new Array ( ) ;
117
+ var maxes = new Array ( ) ;
118
+ var q1s = new Array ( ) ;
119
+ var q3s = new Array ( ) ;
120
+ for ( res in data [ "branches" ] [ branch ] [ exe_id ] ) {
121
+ var date = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 0 ] ;
122
+ var value = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 1 ] ;
123
+ var max = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 2 ] ;
124
+ var q3 = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 3 ] ;
125
+ var q1 = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 4 ] ;
126
+ var min = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 5 ] ;
127
+ if ( min !== "" )
128
+ mins . push ( [ date , min ] ) ;
129
+ if ( max !== "" )
130
+ maxes . push ( [ date , max ] ) ;
131
+ if ( q1 !== "" )
132
+ q1s . push ( [ date , q1 ] ) ;
133
+ if ( q3 !== "" )
134
+ q3s . push ( [ date , q3 ] ) ;
135
+ }
136
+ var extrema = new Array ( mins , maxes ) ;
137
+ var quartiles = new Array ( q1s , q3s ) ;
138
+ if ( shouldPlotQuartiles ( ) ) {
139
+ seriesConfig [ 'rendererOptions' ] = { bandData : quartiles } ;
140
+ } else if ( shouldPlotExtrema ( ) ) {
141
+ seriesConfig [ 'rendererOptions' ] = { bandData : extrema } ;
142
+ }
143
+ if ( shouldPlotQuartiles ( ) && shouldPlotExtrema ( ) ) {
144
+ series . push ( {
145
+ showLabel : false ,
146
+ showMarker : false ,
147
+ color : scaleColorAlpha ( getColor ( exe_id ) , 0.6 ) ,
148
+ rendererOptions : { bandData : extrema }
149
+ } ) ;
150
+ plotdata . push ( data . branches [ branch ] [ exe_id ] ) ;
151
+ hiddenSeries ++ ;
152
+ }
153
+ }
154
+ series . push ( seriesConfig ) ;
75
155
seriesindex . push ( exe_id ) ;
76
156
plotdata . push ( data . branches [ branch ] [ exe_id ] ) ;
77
157
lastvalues . push ( data . branches [ branch ] [ exe_id ] [ 0 ] [ 1 ] ) ;
@@ -121,15 +201,10 @@ function renderPlot(data) {
121
201
}
122
202
} ,
123
203
legend : { show : true , location : 'nw' } ,
124
- highlighter : {
125
- show : true ,
126
- tooltipLocation : 'nw' ,
127
- yvalues : 4 ,
128
- formatString :'<table class="jqplot-highlighter"> <tr><td>date:</td><td>%s</td></tr> <tr><td>result:</td><td>%s</td></tr> <tr><td>std dev:</td><td>%s</td></tr> <tr><td>commit:</td><td>%s</td></tr></table>'
129
- } ,
204
+ highlighter : getHighlighterConfig ( median ) ,
130
205
cursor :{ show :true , zoom :true , showTooltip :false , clickReset :true }
131
206
} ;
132
- if ( series . length > 4 ) {
207
+ if ( series . length > 4 + hiddenSeries ) {
133
208
// Move legend outside plot area to unclutter
134
209
var labels = [ ] ;
135
210
for ( var l in series ) {
@@ -193,6 +268,7 @@ function renderMiniplot(plotid, data) {
193
268
function render ( data ) {
194
269
$ ( "#revisions" ) . attr ( "disabled" , false ) ;
195
270
$ ( "#equidistant" ) . attr ( "disabled" , false ) ;
271
+ $ ( "span.options.median" ) . css ( "display" , "none" ) ;
196
272
$ ( "#plotgrid" ) . html ( "" ) ;
197
273
if ( data . error !== "None" ) {
198
274
var h = $ ( "#content" ) . height ( ) ; //get height for error message
@@ -254,6 +330,8 @@ function initializeSite(event) {
254
330
$ ( "input[name='benchmark']" ) . change ( updateUrl ) ;
255
331
$ ( "input[name='environments']" ) . change ( updateUrl ) ;
256
332
$ ( "#equidistant" ) . change ( updateUrl ) ;
333
+ $ ( "#show_quartile_bands" ) . change ( updateUrl ) ;
334
+ $ ( "#show_extrema_bands" ) . change ( updateUrl ) ;
257
335
}
258
336
259
337
function refreshSite ( event ) {
@@ -307,6 +385,8 @@ function setValuesOfInputFields(event) {
307
385
308
386
$ ( "#baselinecolor" ) . css ( "background-color" , baselineColor ) ;
309
387
$ ( "#equidistant" ) . prop ( 'checked' , valueOrDefault ( event . parameters . equid , defaults . equidistant ) === "on" ) ;
388
+ $ ( "#show_quartile_bands" ) . prop ( 'checked' , valueOrDefault ( event . parameters . quarts , defaults . quartiles ) === "on" ) ;
389
+ $ ( "#show_extrema_bands" ) . prop ( 'checked' , valueOrDefault ( event . parameters . extr , defaults . extrema ) === "on" ) ;
310
390
}
311
391
312
392
function init ( def ) {
0 commit comments