@@ -331,6 +331,9 @@ class BenchmarkController {
331331 case 106 : // j
332332 benchmarkController . showDebugInfo ( ) ;
333333 break ;
334+ case 100 : // d
335+ benchmarkController . downloadDebugInfo ( ) ;
336+ break ;
334337 case 115 : // s
335338 benchmarkController . selectResults ( event . target ) ;
336339 break ;
@@ -380,11 +383,39 @@ class BenchmarkController {
380383 selection . addRange ( range ) ;
381384 } ;
382385
383- var button = Utilities . createElement ( "button" , { } , container ) ;
384- button . textContent = "Done" ;
385- button . onclick = ( ) => {
386+ var doneButton = Utilities . createElement ( "button" , { } , container ) ;
387+ doneButton . textContent = "Done" ;
388+ doneButton . onclick = ( ) => {
386389 this . hideDebugInfo ( ) ;
387390 } ;
391+
392+ var downloadButton = Utilities . createElement ( "button" , { } , container ) ;
393+ downloadButton . textContent = "Download" ;
394+ downloadButton . onclick = ( ) => {
395+ this . downloadDebugInfo ( ) ;
396+ } ;
397+ }
398+
399+ downloadDebugInfo ( )
400+ {
401+ var output = {
402+ version : this . runnerClient . scoreCalculator . version ,
403+ options : this . runnerClient . scoreCalculator . options ,
404+ data : this . runnerClient . scoreCalculator . data
405+ } ;
406+ var json = JSON . stringify ( output , ( key , value ) => {
407+ if ( typeof value === 'number' )
408+ return Utilities . toFixedNumber ( value , 3 ) ;
409+ return value ;
410+ } , 1 ) ;
411+ var blob = new Blob ( [ json ] , { type : "application/json" } ) ;
412+ var url = URL . createObjectURL ( blob ) ;
413+
414+ var a = document . createElement ( 'a' ) ;
415+ a . href = url ;
416+ a . download = 'motionmark-results.json' ;
417+ a . click ( ) ;
418+ URL . revokeObjectURL ( url ) ;
388419 }
389420
390421 selectResults ( target )
0 commit comments