2323 * THE POSSIBILITY OF SUCH DAMAGE.
2424 */
2525
26+ class RunData {
27+ constructor ( version , options , runs = [ ] )
28+ {
29+ this . version = version ;
30+ this . options = options ;
31+ this . runs = runs ;
32+ }
33+ }
34+
2635class ScoreCalculator {
27- constructor ( version , options , testData )
36+ constructor ( runData )
2837 {
29- this . _iterationsSamplers = [ ] ;
30- this . _options = options ;
38+ this . _runData = runData ;
3139 this . _results = null ;
32- this . _version = version ;
33- this . _targetFrameRate = options [ "frame-rate" ] ;
34- this . _systemFrameRate = options [ "system-frame-rate" ] ;
40+ this . _targetFrameRate = runData . options [ "frame-rate" ] ;
41+ this . _systemFrameRate = runData . options [ "system-frame-rate" ] ;
3542
3643 const defaultBootstrapIterations = 2500 ;
37- if ( ! Object . hasOwn ( this . _options , Strings . json . bootstrapIterations ) )
38- this . _options [ Strings . json . bootstrapIterations ] = defaultBootstrapIterations ;
44+ if ( ! Object . hasOwn ( this . _runData . options , Strings . json . bootstrapIterations ) )
45+ this . _runData . options [ Strings . json . bootstrapIterations ] = defaultBootstrapIterations ;
3946
40- if ( testData ) {
41- this . _iterationsSamplers = testData ;
47+ if ( this . _runData . runs . length > 0 )
4248 this . _processData ( ) ;
43- }
4449 }
4550
4651 get targetFrameRate ( )
@@ -50,7 +55,7 @@ class ScoreCalculator {
5055
5156 push ( suitesSamplers )
5257 {
53- this . _iterationsSamplers . push ( suitesSamplers ) ;
58+ this . _runData . runs . push ( suitesSamplers ) ;
5459 }
5560
5661 _processData ( )
@@ -59,7 +64,7 @@ class ScoreCalculator {
5964 this . _results [ Strings . json . results . iterations ] = [ ] ;
6065
6166 var iterationsScores = [ ] ;
62- this . _iterationsSamplers . forEach ( function ( iteration , index ) {
67+ this . _runData . runs . forEach ( function ( iteration , index ) {
6368 var testsScores = [ ] ;
6469 var testsLowerBoundScores = [ ] ;
6570 var testsUpperBoundScores = [ ] ;
@@ -95,7 +100,7 @@ class ScoreCalculator {
95100 iterationsScores . push ( result [ Strings . json . score ] ) ;
96101 } , this ) ;
97102
98- this . _results [ Strings . json . version ] = this . _version ;
103+ this . _results [ Strings . json . version ] = this . _runData . version ;
99104 this . _results [ Strings . json . fps ] = this . _targetFrameRate ;
100105 this . _results [ Strings . json . score ] = Statistics . sampleMean ( iterationsScores . length , iterationsScores . reduce ( function ( a , b ) { return a + b ; } ) ) ;
101106 this . _results [ Strings . json . scoreLowerBound ] = this . _results [ Strings . json . results . iterations ] [ 0 ] [ Strings . json . scoreLowerBound ] ;
@@ -149,7 +154,7 @@ class ScoreCalculator {
149154 samples [ seriesName ] = new SampleData ( series . fieldMap , series . data ) ;
150155 } ) ;
151156
152- var isRampController = this . _options [ " controller" ] == "ramp" ;
157+ var isRampController = this . _runData . options [ Strings . json . controller ] == "ramp" ;
153158 var predominantProfile = "" ;
154159 if ( isRampController ) {
155160 var profiles = { } ;
@@ -198,7 +203,7 @@ class ScoreCalculator {
198203 experimentResult [ Strings . json . measurements . stdev ] = timeComplexity . standardDeviation ( ) ;
199204 experimentResult [ Strings . json . measurements . percent ] = timeComplexity . percentage ( ) ;
200205
201- const bootstrapIterations = this . _options [ Strings . json . bootstrapIterations ] ;
206+ const bootstrapIterations = this . _runData . options [ Strings . json . bootstrapIterations ] ;
202207 var bootstrapResult = Regression . bootstrap ( regressionResult . samples . data , bootstrapIterations , function ( resampleData ) {
203208 var complexityIndex = regressionResult . samples . fieldMap [ Strings . json . complexity ] ;
204209 resampleData . sort ( function ( a , b ) {
@@ -265,7 +270,7 @@ class ScoreCalculator {
265270
266271 get data ( )
267272 {
268- return this . _iterationsSamplers ;
273+ return this . _runData . runs ;
269274 }
270275
271276 get results ( )
@@ -278,12 +283,12 @@ class ScoreCalculator {
278283
279284 get options ( )
280285 {
281- return this . _options ;
286+ return this . _runData . options ;
282287 }
283288
284289 get version ( )
285290 {
286- return this . _version ;
291+ return this . _runData . version ;
287292 }
288293
289294 _getResultsProperty ( property )
0 commit comments