| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A simple stopwatch interface to measure elapsed time. | 8 * A simple stopwatch interface to measure elapsed time. |
| 9 */ | 9 */ |
| 10 class Stopwatch { | 10 class Stopwatch { |
| 11 /** | 11 /** |
| 12 * Frequency of the elapsed counter in Hz. | 12 * Frequency of the elapsed counter in Hz. |
| 13 */ | 13 */ |
| 14 int get frequency => _frequency; | 14 int get frequency => _frequency; |
| 15 | 15 |
| 16 // The _start and _stop fields capture the time when [start] and [stop] | 16 // The _start and _stop fields capture the time when [start] and [stop] |
| 17 // are called respectively. | 17 // are called respectively. |
| 18 // If _start is null, then the [Stopwatch] has not been started yet. | 18 // If _start is null, then the [Stopwatch] has not been started yet. |
| 19 // If _stop is null, then the [Stopwatch] has not been stopped yet, | 19 // If _stop is null, then the [Stopwatch] has not been stopped yet, |
| 20 // or is running. | 20 // or is running. |
| 21 num _start; | 21 int _start; |
| 22 num _stop; | 22 int _stop; |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * Creates a [Stopwatch] in stopped state with a zero elapsed count. | 25 * Creates a [Stopwatch] in stopped state with a zero elapsed count. |
| 26 * | 26 * |
| 27 * The following example shows how to start a [Stopwatch] | 27 * The following example shows how to start a [Stopwatch] |
| 28 * immediately after allocation. | 28 * immediately after allocation. |
| 29 * | 29 * |
| 30 * Stopwatch stopwatch = new Stopwatch()..start(); | 30 * Stopwatch stopwatch = new Stopwatch()..start(); |
| 31 */ | 31 */ |
| 32 Stopwatch() { | 32 Stopwatch() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 */ | 134 */ |
| 135 static int _frequency; | 135 static int _frequency; |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Initializes the time-measuring system. *Must* initialize the [_frequency] | 138 * Initializes the time-measuring system. *Must* initialize the [_frequency] |
| 139 * variable. | 139 * variable. |
| 140 */ | 140 */ |
| 141 external static void _initTicker(); | 141 external static void _initTicker(); |
| 142 external static int _now(); | 142 external static int _now(); |
| 143 } | 143 } |
| OLD | NEW |