OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 BenchmarkTests; | 5 part of BenchmarkTests; |
6 | 6 |
7 /** | 7 /** |
8 * The results of a single block of tests (count times run, overall time). | 8 * The results of a single block of tests (count times run, overall time). |
9 */ | 9 */ |
10 class BlockSample { | 10 class BlockSample { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 String id; | 192 String id; |
193 String desc; | 193 String desc; |
194 List<BlockSample> warmup; | 194 List<BlockSample> warmup; |
195 List<BlockSample> results; | 195 List<BlockSample> results; |
196 } | 196 } |
197 | 197 |
198 class Runner { | 198 class Runner { |
| 199 static List<String> arguments; // Set by main. |
| 200 |
199 static bool runTest(String testId) { | 201 static bool runTest(String testId) { |
200 Options opts = new Options(); | 202 return arguments.length == 0 || |
201 return opts.arguments.length == 0 || | 203 arguments.any((String id) => id == testId); |
202 opts.arguments.any((String id) => id == testId); | |
203 } | 204 } |
204 } | 205 } |
205 | 206 |
206 /** | 207 /** |
207 * Run traditional blocking-style tests. Tests may be run a specified number | 208 * Run traditional blocking-style tests. Tests may be run a specified number |
208 * of times, or they can be run based on performance to estimate a particular | 209 * of times, or they can be run based on performance to estimate a particular |
209 * duration. | 210 * duration. |
210 */ | 211 */ |
211 class BenchmarkRunner extends Runner { | 212 class BenchmarkRunner extends Runner { |
212 static void runCount(String id, String desc, CountTestConfig config, | 213 static void runCount(String id, String desc, CountTestConfig config, |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 _(TestReport r) => r.printReport() : reportHandler; | 451 _(TestReport r) => r.printReport() : reportHandler; |
451 } | 452 } |
452 | 453 |
453 Function _reportHandler; | 454 Function _reportHandler; |
454 Function get reportHandler => _reportHandler; | 455 Function get reportHandler => _reportHandler; |
455 int _warmup; | 456 int _warmup; |
456 int _targetTimeMs; | 457 int _targetTimeMs; |
457 int _minSampleTimeMs; | 458 int _minSampleTimeMs; |
458 int _blocksize; | 459 int _blocksize; |
459 } | 460 } |
OLD | NEW |