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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 int totalBytes = sizeBytes * resultsCount(); | 162 int totalBytes = sizeBytes * resultsCount(); |
163 String mbPerSec = (((1E9 * sizeBytes * resultsCount()) / | 163 String mbPerSec = (((1E9 * sizeBytes * resultsCount()) / |
164 (1024 * 1024 * resultsNanos()))).toString(); | 164 (1024 * 1024 * resultsNanos()))).toString(); |
165 print("${text} total time:${totalDurationMs} ms" + | 165 print("${text} total time:${totalDurationMs} ms" + |
166 " iterations:${totalCount}" + | 166 " iterations:${totalCount}" + |
167 " mean:${meanDuration} ns; ${mbPerSec} MB/sec"); | 167 " mean:${meanDuration} ns; ${mbPerSec} MB/sec"); |
168 } | 168 } |
169 | 169 |
170 String _leftAlign(String s, int width) { | 170 String _leftAlign(String s, int width) { |
171 List<int> outCodes = []; | 171 List<int> outCodes = new List<int>.filled(width, spaceChar); |
172 outCodes.insertRange(0, width, spaceChar); | |
173 outCodes.setRange(0, Math.min(width, s.length), s.codeUnits); | 172 outCodes.setRange(0, Math.min(width, s.length), s.codeUnits); |
174 return new String.fromCharCodes(outCodes); | 173 return new String.fromCharCodes(outCodes); |
175 } | 174 } |
176 | 175 |
177 String _rightAlign(String s, int width) { | 176 String _rightAlign(String s, int width) { |
178 List<int> outCodes = []; | 177 List<int> outCodes = new List<int>.filled(width, spaceChar); |
179 outCodes.insertRange(0, width, spaceChar); | |
180 int fromIndex = Math.max(0, width - s.length); | 178 int fromIndex = Math.max(0, width - s.length); |
181 int length = Math.min(width, s.length); | 179 int length = Math.min(width, s.length); |
182 outCodes.setRange(fromIndex, fromIndex + length, s.codeUnits); | 180 outCodes.setRange(fromIndex, fromIndex + length, s.codeUnits); |
183 return new String.fromCharCodes(outCodes); | 181 return new String.fromCharCodes(outCodes); |
184 } | 182 } |
185 | 183 |
186 static String _stringifyDoubleAsInt(double val) { | 184 static String _stringifyDoubleAsInt(double val) { |
187 if (val.isInfinite || val.isNaN) { | 185 if (val.isInfinite || val.isNaN) { |
188 return "NaN"; | 186 return "NaN"; |
189 } else { | 187 } else { |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 _(TestReport r) => r.printReport() : reportHandler; | 450 _(TestReport r) => r.printReport() : reportHandler; |
453 } | 451 } |
454 | 452 |
455 Function _reportHandler; | 453 Function _reportHandler; |
456 Function get reportHandler => _reportHandler; | 454 Function get reportHandler => _reportHandler; |
457 int _warmup; | 455 int _warmup; |
458 int _targetTimeMs; | 456 int _targetTimeMs; |
459 int _minSampleTimeMs; | 457 int _minSampleTimeMs; |
460 int _blocksize; | 458 int _blocksize; |
461 } | 459 } |
OLD | NEW |