Encapsulate private properties in PerfTestRunner better
[WebKit-https.git] / LayoutTests / fast / harness / perftests / runs-per-second-log.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p id="description">This test verifies PerfTestRunner.runPerSecond() outputs log as expected.</p>
5 <div id="console"></div>
6 <script src="../../../../PerformanceTests/resources/runner.js"></script>
7 <script type="text/javascript">
8
9 var logLines = [];
10 var initial = true;
11 var runs = 0;
12
13 var iteration = 0;
14 var currentTime = 0;
15
16 PerfTestRunner.now = function () {
17     iteration++;
18     if (iteration % 2 == 0)
19         currentTime += 1000 / runs;
20     return currentTime;
21 }
22
23 PerfTestRunner.storeHeapResults = function () { }
24
25 var printStatistics = PerfTestRunner.printStatistics;
26 PerfTestRunner.printStatistics = function (statistics, title) {
27     if (statistics.unit == 'bytes')
28         return;
29     statistics.stdev = statistics.stdev.toPrecision(3);
30     return printStatistics.call(PerfTestRunner, statistics, title);
31 }
32
33 PerfTestRunner.runPerSecond({
34     setup: function () {
35         runs++;
36         // Avoid 3, 6, 7, 9.
37         if (runs == 6)
38             runs += 2;
39         else if (!(runs % 3))
40             runs++;
41     },
42     run: function () { },
43     runCount: 5,
44 });
45
46 </script>
47 </body>
48 </html>