1
1
/*
2
- * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
2
+ * Copyright (C) 2018-2024 Apple Inc. All rights reserved.
3
3
*
4
4
* Redistribution and use in source and binary forms, with or without
5
5
* modification, are permitted provided that the following conditions
22
22
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
23
* THE POSSIBILITY OF SUCH DAMAGE.
24
24
*/
25
- ResultsDashboard = Utilities . createClass (
26
- function ( version , options , testData )
25
+
26
+ class ResultsDashboard {
27
+ constructor ( version , options , testData )
27
28
{
28
29
this . _iterationsSamplers = [ ] ;
29
30
this . _options = options ;
35
36
this . _iterationsSamplers = testData ;
36
37
this . _processData ( ) ;
37
38
}
38
- } , {
39
+ }
39
40
40
- push : function ( suitesSamplers )
41
+ push ( suitesSamplers )
41
42
{
42
43
this . _iterationsSamplers . push ( suitesSamplers ) ;
43
- } ,
44
+ }
44
45
45
- _processData : function ( )
46
+ _processData ( )
46
47
{
47
48
this . _results = { } ;
48
49
this . _results [ Strings . json . results . iterations ] = [ ] ;
89
90
this . _results [ Strings . json . score ] = Statistics . sampleMean ( iterationsScores . length , iterationsScores . reduce ( function ( a , b ) { return a + b ; } ) ) ;
90
91
this . _results [ Strings . json . scoreLowerBound ] = this . _results [ Strings . json . results . iterations ] [ 0 ] [ Strings . json . scoreLowerBound ] ;
91
92
this . _results [ Strings . json . scoreUpperBound ] = this . _results [ Strings . json . results . iterations ] [ 0 ] [ Strings . json . scoreUpperBound ] ;
92
- } ,
93
+ }
93
94
94
- calculateScore : function ( data )
95
+ calculateScore ( data )
95
96
{
96
97
var result = { } ;
97
98
data [ Strings . json . result ] = result ;
250
251
result [ Strings . json . scoreLowerBound ] = result [ Strings . json . score ] - averageFrameLength . standardDeviation ( ) ;
251
252
result [ Strings . json . scoreUpperBound ] = result [ Strings . json . score ] + averageFrameLength . standardDeviation ( ) ;
252
253
}
253
- } ,
254
+ }
254
255
255
256
get data ( )
256
257
{
257
258
return this . _iterationsSamplers ;
258
- } ,
259
+ }
259
260
260
261
get results ( )
261
262
{
262
263
if ( this . _results )
263
264
return this . _results [ Strings . json . results . iterations ] ;
264
265
this . _processData ( ) ;
265
266
return this . _results [ Strings . json . results . iterations ] ;
266
- } ,
267
+ }
267
268
268
269
get options ( )
269
270
{
270
271
return this . _options ;
271
- } ,
272
+ }
272
273
273
274
get version ( )
274
275
{
275
276
return this . _version ;
276
- } ,
277
+ }
277
278
278
- _getResultsProperty : function ( property )
279
+ _getResultsProperty ( property )
279
280
{
280
281
if ( this . _results )
281
282
return this . _results [ property ] ;
282
283
this . _processData ( ) ;
283
284
return this . _results [ property ] ;
284
- } ,
285
+ }
285
286
286
287
get score ( )
287
288
{
288
289
return this . _getResultsProperty ( Strings . json . score ) ;
289
- } ,
290
+ }
290
291
291
292
get scoreLowerBound ( )
292
293
{
293
294
return this . _getResultsProperty ( Strings . json . scoreLowerBound ) ;
294
- } ,
295
+ }
295
296
296
297
get scoreUpperBound ( )
297
298
{
298
299
return this . _getResultsProperty ( Strings . json . scoreUpperBound ) ;
299
300
}
300
- } ) ;
301
+ }
301
302
302
- ResultsTable = Utilities . createClass (
303
- function ( element , headers )
303
+ class ResultsTable {
304
+ constructor ( element , headers )
304
305
{
305
306
this . element = element ;
306
307
this . _headers = headers ;
@@ -321,14 +322,14 @@ ResultsTable = Utilities.createClass(
321
322
} ) ;
322
323
323
324
this . clear ( ) ;
324
- } , {
325
+ }
325
326
326
- clear : function ( )
327
+ clear ( )
327
328
{
328
329
this . element . textContent = "" ;
329
- } ,
330
+ }
330
331
331
- _addHeader : function ( )
332
+ _addHeader ( )
332
333
{
333
334
var thead = Utilities . createElement ( "thead" , { } , this . element ) ;
334
335
var row = Utilities . createElement ( "tr" , { } , thead ) ;
@@ -343,22 +344,22 @@ ResultsTable = Utilities.createClass(
343
344
if ( header . children )
344
345
th . colSpan = header . children . length ;
345
346
} ) ;
346
- } ,
347
+ }
347
348
348
- _addBody : function ( )
349
+ _addBody ( )
349
350
{
350
351
this . tbody = Utilities . createElement ( "tbody" , { } , this . element ) ;
351
- } ,
352
+ }
352
353
353
- _addEmptyRow : function ( )
354
+ _addEmptyRow ( )
354
355
{
355
356
var row = Utilities . createElement ( "tr" , { } , this . tbody ) ;
356
357
this . _flattenedHeaders . forEach ( function ( header ) {
357
358
return Utilities . createElement ( "td" , { class : "suites-separator" } , row ) ;
358
359
} ) ;
359
- } ,
360
+ }
360
361
361
- _addTest : function ( testName , testResult , options )
362
+ _addTest ( testName , testResult , options )
362
363
{
363
364
var row = Utilities . createElement ( "tr" , { } , this . tbody ) ;
364
365
@@ -374,9 +375,9 @@ ResultsTable = Utilities.createClass(
374
375
} else
375
376
td . innerHTML = header . text ( testResult ) ;
376
377
} , this ) ;
377
- } ,
378
+ }
378
379
379
- _addIteration : function ( iterationResult , iterationData , options )
380
+ _addIteration ( iterationResult , iterationData , options )
380
381
{
381
382
var testsResults = iterationResult [ Strings . json . results . tests ] ;
382
383
for ( var suiteName in testsResults ) {
@@ -386,9 +387,9 @@ ResultsTable = Utilities.createClass(
386
387
for ( var testName in suiteResult )
387
388
this . _addTest ( testName , suiteResult [ testName ] , options , suiteData [ testName ] ) ;
388
389
}
389
- } ,
390
+ }
390
391
391
- showIterations : function ( dashboard )
392
+ showIterations ( dashboard )
392
393
{
393
394
this . clear ( ) ;
394
395
this . _addHeader ( ) ;
@@ -399,7 +400,7 @@ ResultsTable = Utilities.createClass(
399
400
this . _addIteration ( iterationResult , dashboard . data [ index ] , dashboard . options ) ;
400
401
} , this ) ;
401
402
}
402
- } ) ;
403
+ }
403
404
404
405
window . benchmarkRunnerClient = {
405
406
iterationCount : 1 ,
0 commit comments