[benchmark] Refactor numIters computation

The spaghetti if-else code was untangled into nested function that computes `iterationsPerSampleTime` and a single constant `numIters` expression that takes care of the overflow capping as well as the choice between fixed and computed `numIters` value.

The `numIters` is now computed and logged only once per benchmark measurement instead of on every sample.

The sampling loop is now just a single line. Hurrah!

Modified test to verify that the `LogParser` maintains `num-iters` derived from the `Measuring with scale` message across samples.
This commit is contained in:
Pavol Vaskovic
2018-08-31 00:06:29 +02:00
parent 46ee2a4bd8
commit be39c02001
3 changed files with 29 additions and 39 deletions

View File

@@ -369,7 +369,6 @@ Running AngryPhonebook for 3 samples.
Sample 0,11812
Measuring with scale 90.
Sample 1,13898
Measuring with scale 91.
Sample 2,11467
1,AngryPhonebook,3,11467,13898,12392,1315,11812
Running Array2D for 3 samples.
@@ -389,7 +388,7 @@ Totals,2"""
)
self.assertEquals(r.num_samples, r.samples.num_samples)
self.assertEquals(results[0].samples.all_samples,
[(0, 78, 11812), (1, 90, 13898), (2, 91, 11467)])
[(0, 78, 11812), (1, 90, 13898), (2, 90, 11467)])
r = results[1]
self.assertEquals(