@@ -29,6 +29,7 @@ function getConfiguration() {
2929 ben : readCheckbox ( "input[name='benchmarks']:checked" ) ,
3030 env : readCheckbox ( "input[name='environments']:checked" ) ,
3131 hor : $ ( "input[name='direction']" ) . is ( ':checked' ) ,
32+ com : $ ( "input[name='common_only']" ) . is ( ':checked' ) ,
3233 bas : $ ( "#baseline option:selected" ) . val ( ) || "none" ,
3334 chart : $ ( "#chart_type option:selected" ) . val ( )
3435 } ;
@@ -141,11 +142,28 @@ function updateGraphTitle(exes, enviros, bens, baseline, chart, chartTitles) {
141142 $title . text ( chartTitles . join ( ' / ' ) ) ;
142143}
143144
145+ // Keep only the benchmarks that have a result for every selected
146+ // executable/environment pair, so each bar group covers the same set.
147+ function filterCommonBenchmarks ( bens , exes , enviros ) {
148+ if ( ! compdata ) { return bens ; }
149+ return bens . filter ( function ( ben ) {
150+ return exes . every ( function ( exe ) {
151+ return enviros . every ( function ( env ) {
152+ var val = compdata [ exe ] && compdata [ exe ] [ env ]
153+ ? compdata [ exe ] [ env ] [ ben ]
154+ : null ;
155+ return val !== null && val !== undefined ;
156+ } ) ;
157+ } ) ;
158+ } ) ;
159+ }
160+
144161function refreshContent ( ) {
145162 var conf = getConfiguration ( ) ,
146163 exes = conf . exe . split ( "," ) ,
147164 bens = conf . ben . split ( "," ) ,
148165 enviros = conf . env . split ( "," ) ,
166+ hiddenCount = 0 ,
149167 msg = "" ;
150168
151169 $ ( "#graph-title" ) . html ( "" ) ;
@@ -159,7 +177,19 @@ function refreshContent() {
159177 } else if ( enviros [ 0 ] === "" ) {
160178 $ ( "#plotwrapper" ) . html ( '<p class="warning">No environments selected</p>' ) ;
161179 return false ;
162- } else if ( conf . chart === "relative bars" && conf . bas === "none" ) {
180+ }
181+
182+ if ( conf . com ) {
183+ var common = filterCommonBenchmarks ( bens , exes , enviros ) ;
184+ hiddenCount = bens . length - common . length ;
185+ bens = common ;
186+ if ( bens . length === 0 ) {
187+ $ ( "#plotwrapper" ) . html ( '<p class="warning">No benchmark has results for every selected executable and environment</p>' ) ;
188+ return false ;
189+ }
190+ }
191+
192+ if ( conf . chart === "relative bars" && conf . bas === "none" ) {
163193 msg = '<p class="warning">For relative bar charts, you must select a baseline to normalize to.</p>' ;
164194 $ ( "#plotwrapper" ) . html ( msg ) ;
165195 return false ;
@@ -183,6 +213,14 @@ function refreshContent() {
183213 }
184214 }
185215
216+ var hiddenMsg = "" ;
217+ if ( hiddenCount > 0 ) {
218+ hiddenMsg = '<p class="warning">' + hiddenCount + ' benchmark' +
219+ ( hiddenCount === 1 ? '' : 's' ) +
220+ ' hidden because not every selected executable has a result for ' +
221+ ( hiddenCount === 1 ? 'it' : 'them' ) + '.</p>' ;
222+ }
223+
186224 chartInstances . forEach ( function ( c ) { c . destroy ( ) ; } ) ;
187225 chartInstances = [ ] ;
188226 $ ( "#plotwrapper" ) . fadeOut ( "fast" , function ( ) {
@@ -204,6 +242,8 @@ function refreshContent() {
204242 var t = renderComparisonPlot ( plotid , unit , benchmarks , exes , enviros , conf . bas , conf . chart , conf . hor ) ;
205243 chartTitles . push ( t ) ;
206244 }
245+ // Shown below the chart(s) so it does not push them down
246+ $ ( "#plotwrapper" ) . append ( hiddenMsg ) ;
207247 updateGraphTitle ( exes , enviros , bens , conf . bas , conf . chart , chartTitles ) ;
208248 } ) ;
209249}
@@ -445,6 +485,7 @@ function init(defaults) {
445485 // Set default values
446486 $ ( "#chart_type" ) . val ( defaults . chart_type ) ;
447487 $ ( "#direction" ) . prop ( 'checked' , defaults . direction === "True" ) ;
488+ $ ( "#common_only" ) . prop ( 'checked' , defaults . common_only === "True" ) ;
448489
449490 /*
450491 var sel = $("input[name='executables']");
@@ -477,7 +518,7 @@ function init(defaults) {
477518 $ ( "#benchmark .checkall, #benchmark .uncheckall" ) . click ( loadData ) ;
478519
479520 // Re-render without re-fetching for other controls
480- $ ( "#chart_type, #baseline, #direction" ) . change ( refreshContent ) ;
521+ $ ( "#chart_type, #baseline, #direction, #common_only " ) . change ( refreshContent ) ;
481522 $ ( "input[name='environments']" ) . change ( function ( ) {
482523 updateBaselineDropdown ( ) ;
483524 refreshContent ( ) ;
@@ -536,6 +577,9 @@ function init(defaults) {
536577 var exes = conf . exe ? conf . exe . split ( "," ) . filter ( Boolean ) : [ ] ;
537578 var enviros = readCheckbox ( "input[name='environments']:checked" ) . split ( "," ) . filter ( Boolean ) ;
538579 var benchmarks = conf . ben ? conf . ben . split ( "," ) . filter ( Boolean ) : [ ] ;
580+ if ( conf . com ) {
581+ benchmarks = filterCommonBenchmarks ( benchmarks , exes , enviros ) ;
582+ }
539583
540584 // Header row: benchmark, then one column per exe@env
541585 var header = [ "benchmark" ] ;
0 commit comments