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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 String _leftAlign(String s, int width) { | 170 String _leftAlign(String s, int width) { |
171 List<int> outCodes = []; | 171 List<int> outCodes = []; |
172 outCodes.insertRange(0, width, spaceChar); | 172 outCodes.insertRange(0, width, spaceChar); |
173 outCodes.setRange(0, Math.min(width, s.length), s.codeUnits); | 173 outCodes.setRange(0, Math.min(width, s.length), s.codeUnits); |
174 return new String.fromCharCodes(outCodes); | 174 return new String.fromCharCodes(outCodes); |
175 } | 175 } |
176 | 176 |
177 String _rightAlign(String s, int width) { | 177 String _rightAlign(String s, int width) { |
178 List<int> outCodes = []; | 178 List<int> outCodes = []; |
179 outCodes.insertRange(0, width, spaceChar); | 179 outCodes.insertRange(0, width, spaceChar); |
180 outCodes.setRange(Math.max(0, width - s.length), Math.min(width, s.length), | 180 int fromIndex = Math.max(0, width - s.length); |
181 s.codeUnits); | 181 int length = Math.min(width, s.length); |
| 182 outCodes.setRange(fromIndex, fromIndex + length, s.codeUnits); |
182 return new String.fromCharCodes(outCodes); | 183 return new String.fromCharCodes(outCodes); |
183 } | 184 } |
184 | 185 |
185 static String _stringifyDoubleAsInt(double val) { | 186 static String _stringifyDoubleAsInt(double val) { |
186 if (val.isInfinite || val.isNaN) { | 187 if (val.isInfinite || val.isNaN) { |
187 return "NaN"; | 188 return "NaN"; |
188 } else { | 189 } else { |
189 return val.toInt().toString(); | 190 return val.toInt().toString(); |
190 } | 191 } |
191 } | 192 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 _(TestReport r) => r.printReport() : reportHandler; | 452 _(TestReport r) => r.printReport() : reportHandler; |
452 } | 453 } |
453 | 454 |
454 Function _reportHandler; | 455 Function _reportHandler; |
455 Function get reportHandler => _reportHandler; | 456 Function get reportHandler => _reportHandler; |
456 int _warmup; | 457 int _warmup; |
457 int _targetTimeMs; | 458 int _targetTimeMs; |
458 int _minSampleTimeMs; | 459 int _minSampleTimeMs; |
459 int _blocksize; | 460 int _blocksize; |
460 } | 461 } |
OLD | NEW |