OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of benchmark_lib; | 5 part of benchmark_lib; |
6 | 6 |
7 /** Accessors for our Singleton variables. */ | 7 /** Accessors for our Singleton variables. */ |
8 BenchmarkSuite get BENCHMARK_SUITE { | 8 BenchmarkSuite get BENCHMARK_SUITE { |
9 if (BenchmarkSuite._ONLY == null) { | 9 if (BenchmarkSuite._ONLY == null) { |
10 BenchmarkSuite._ONLY = new BenchmarkSuite._internal(); | 10 BenchmarkSuite._ONLY = new BenchmarkSuite._internal(); |
(...skipping 19 matching lines...) Expand all Loading... |
30 * The benchmark code. | 30 * The benchmark code. |
31 * This function is not used, if both [warmup] and [exercise] are overwritten. | 31 * This function is not used, if both [warmup] and [exercise] are overwritten. |
32 */ | 32 */ |
33 void run() {} | 33 void run() {} |
34 | 34 |
35 /** Runs a short version of the benchmark. By default invokes [run] once. */ | 35 /** Runs a short version of the benchmark. By default invokes [run] once. */ |
36 void warmup() { | 36 void warmup() { |
37 run(); | 37 run(); |
38 } | 38 } |
39 | 39 |
40 /** Exercices the benchmark. By default invokes [run] 10 times. */ | 40 /** Exercises the benchmark. By default invokes [run] 10 times. */ |
41 void exercise() { | 41 void exercise() { |
42 for (int i = 0; i < 10; i++) { | 42 for (int i = 0; i < 10; i++) { |
43 run(); | 43 run(); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 /** Not measured setup code executed prior to the benchmark runs. */ | 47 /** Not measured setup code executed prior to the benchmark runs. */ |
48 void setup() {} | 48 void setup() {} |
49 | 49 |
50 /** Not measures teardown code executed after the benchmark runs. */ | 50 /** Not measures teardown code executed after the benchmark runs. */ |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 * helping readability of the scores. | 194 * helping readability of the scores. |
195 */ | 195 */ |
196 String formatScore(num value) { | 196 String formatScore(num value) { |
197 if (value > 100) { | 197 if (value > 100) { |
198 return value.toStringAsFixed(0); | 198 return value.toStringAsFixed(0); |
199 } else { | 199 } else { |
200 return value.toStringAsFixed(2); | 200 return value.toStringAsFixed(2); |
201 } | 201 } |
202 } | 202 } |
203 } | 203 } |
OLD | NEW |