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 /** | 5 /** |
6 * The results of a single block of tests (count times run, overall time). | 6 * The results of a single block of tests (count times run, overall time). |
7 */ | 7 */ |
8 class BlockSample { | 8 class BlockSample { |
9 BlockSample(this.count, this.durationNanos); | 9 BlockSample(this.count, this.durationNanos); |
10 int count; | 10 int count; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return samples; | 266 return samples; |
267 } | 267 } |
268 | 268 |
269 static BlockSample _execBlock(Function test, int count) { | 269 static BlockSample _execBlock(Function test, int count) { |
270 Stopwatch s = new Stopwatch(); | 270 Stopwatch s = new Stopwatch(); |
271 s.start(); | 271 s.start(); |
272 for (int i = 0; i < count; i++) { | 272 for (int i = 0; i < count; i++) { |
273 test(); | 273 test(); |
274 } | 274 } |
275 s.stop(); | 275 s.stop(); |
276 return new BlockSample(count, s.elapsedInUs() * 1000); | 276 return new BlockSample(count, s.elapsedMicroseconds * 1000); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 /** | 280 /** |
281 * Define CPSTest type. | 281 * Define CPSTest type. |
282 */ | 282 */ |
283 typedef void CPSTest(Function continuation); | 283 typedef void CPSTest(Function continuation); |
284 | 284 |
285 typedef void ReportHandler(TestReport r); | 285 typedef void ReportHandler(TestReport r); |
286 | 286 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 _(TestReport r) => r.printReport() : reportHandler; | 450 _(TestReport r) => r.printReport() : reportHandler; |
451 } | 451 } |
452 | 452 |
453 Function _reportHandler; | 453 Function _reportHandler; |
454 Function get reportHandler => _reportHandler; | 454 Function get reportHandler => _reportHandler; |
455 int _warmup; | 455 int _warmup; |
456 int _targetTimeMs; | 456 int _targetTimeMs; |
457 int _minSampleTimeMs; | 457 int _minSampleTimeMs; |
458 int _blocksize; | 458 int _blocksize; |
459 } | 459 } |
OLD | NEW |