Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(703)

Side by Side Diff: utils/tests/string_encoding/benchmark_runner.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/tests/pub/yaml_test.dart ('k') | utils/tests/string_encoding/dunit.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 int resultsCount() => BlockSample._totalCount(results); 97 int resultsCount() => BlockSample._totalCount(results);
98 98
99 int resultsNanos() => BlockSample._totalTime(results); 99 int resultsNanos() => BlockSample._totalTime(results);
100 100
101 int resultsBestNanos() { 101 int resultsBestNanos() {
102 BlockSample best = bestBlock(results); 102 BlockSample best = bestBlock(results);
103 return best.durationNanos ~/ best.count; 103 return best.durationNanos ~/ best.count;
104 } 104 }
105 105
106 int resultsMeanNanos() => 106 int resultsMeanNanos() =>
107 (BlockSample._totalTime(results) / 107 BlockSample._totalTime(results) ~/ BlockSample._totalCount(results);
108 BlockSample._totalCount(results)).toInt();
109 108
110 int resultsWorstNanos() { 109 int resultsWorstNanos() {
111 BlockSample worst = worstBlock(results); 110 BlockSample worst = worstBlock(results);
112 return worst.durationNanos / worst.count; 111 return worst.durationNanos / worst.count;
113 } 112 }
114 113
115 int warmupBestNanos() { 114 int warmupBestNanos() {
116 BlockSample best = bestBlock(warmup); 115 BlockSample best = bestBlock(warmup);
117 return best.durationNanos / best.count; 116 return best.durationNanos / best.count;
118 } 117 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 String id; 191 String id;
193 String desc; 192 String desc;
194 List<BlockSample> warmup; 193 List<BlockSample> warmup;
195 List<BlockSample> results; 194 List<BlockSample> results;
196 } 195 }
197 196
198 class Runner { 197 class Runner {
199 static bool runTest(String testId) { 198 static bool runTest(String testId) {
200 Options opts = new Options(); 199 Options opts = new Options();
201 return opts.arguments.length == 0 || 200 return opts.arguments.length == 0 ||
202 opts.arguments.some(_(String id) => id == testId); 201 opts.arguments.any((String id) => id == testId);
203 } 202 }
204 } 203 }
205 204
206 /** 205 /**
207 * Run traditional blocking-style tests. Tests may be run a specified number 206 * 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 207 * of times, or they can be run based on performance to estimate a particular
209 * duration. 208 * duration.
210 */ 209 */
211 class BenchmarkRunner extends Runner { 210 class BenchmarkRunner extends Runner {
212 static void runCount(String id, String desc, CountTestConfig config, 211 static void runCount(String id, String desc, CountTestConfig config,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 _(TestReport r) => r.printReport() : reportHandler; 449 _(TestReport r) => r.printReport() : reportHandler;
451 } 450 }
452 451
453 Function _reportHandler; 452 Function _reportHandler;
454 Function get reportHandler => _reportHandler; 453 Function get reportHandler => _reportHandler;
455 int _warmup; 454 int _warmup;
456 int _targetTimeMs; 455 int _targetTimeMs;
457 int _minSampleTimeMs; 456 int _minSampleTimeMs;
458 int _blocksize; 457 int _blocksize;
459 } 458 }
OLDNEW
« no previous file with comments | « utils/tests/pub/yaml_test.dart ('k') | utils/tests/string_encoding/dunit.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698