Chromium Code Reviews| 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 /** | 5 /** |
| 6 * A simple [StopWatch] interface to measure elapsed time. | 6 * A simple [Stopwatch] interface to measure elapsed time. |
| 7 */ | 7 */ |
| 8 interface StopWatch factory StopWatchImplementation { | 8 interface Stopwatch factory StopwatchImplementation { |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Creates a [StopWatch] in stopped state with a zero elapsed count. | 11 * Creates a [Stopwatch] in stopped state with a zero elapsed count. |
| 12 */ | 12 */ |
| 13 StopWatch(); | 13 Stopwatch(); |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Starts the [StopWatch]. The [elapsed] count is increasing monotonically. | 16 * Creates a [Stopwatch] in started state with a zero elapsed count. |
| 17 * If the [StopWatch] has been stopped, then calling start again restarts it. | 17 */ |
| 18 * If the [StopWatch] is currently running, then calling start does nothing. | 18 Stopwatch.start(); |
| 19 | |
| 20 /** | |
| 21 * Starts the [Stopwatch]. The [elapsed] count is increasing monotonically. | |
| 22 * If the [Stopwatch] has been stopped, then calling start again restarts it | |
| 23 * without resetting the [elapsed] count. | |
| 24 * If the [Stopwatch] is currently running, then calling start does nothing. | |
| 19 */ | 25 */ |
| 20 void start(); | 26 void start(); |
| 21 | 27 |
| 22 /** | 28 /** |
| 23 * Stops the [StopWatch]. The [elapsed] count stops increasing. | 29 * Stops the [Stopwatch]. The [elapsed] count stops increasing. |
| 24 * If the [StopWatch] is currently not running, then calling stop does nothing . | 30 * If the [Stopwatch] is currently not running, then calling stop does nothing . |
|
Ivan Posva
2011/11/11 16:31:54
line too long?
floitsch
2011/11/14 13:55:59
Done.
| |
| 25 */ | 31 */ |
| 26 void stop(); | 32 void stop(); |
| 27 | 33 |
| 28 /** | 34 /** |
| 35 * Resets the [elapsed] count to zero. This method does not stop or start | |
| 36 * the [Stopwatch]. | |
| 37 */ | |
| 38 void reset(); | |
| 39 | |
| 40 /** | |
| 29 * Returns the elapsed number of clock ticks since calling [start] while the | 41 * Returns the elapsed number of clock ticks since calling [start] while the |
| 30 * [StopWatch] is running. | 42 * [Stopwatch] is running. |
| 31 * Returns the elapsed number of clock ticks between calling [start] and | 43 * Returns the elapsed number of clock ticks between calling [start] and |
| 32 * calling [stop]. | 44 * calling [stop]. |
| 33 * Returns 0 if the [StopWatch] has never been started. | 45 * Returns 0 if the [Stopwatch] has never been started. |
| 34 * The elapsed number of clock ticks increases by [frequency] every second. | 46 * The elapsed number of clock ticks increases by [frequency] every second. |
| 35 */ | 47 */ |
| 36 int elapsed(); | 48 int elapsed(); |
| 37 | 49 |
| 38 /** | 50 /** |
| 39 * Returns the [elapsed] counter converted to microseconds. | 51 * Returns the [elapsed] counter converted to microseconds. |
| 40 */ | 52 */ |
| 41 int elapsedInUs(); | 53 int elapsedInUs(); |
| 42 | 54 |
| 43 /** | 55 /** |
| 44 * Returns the [elapsed] counter converted to milliseconds. | 56 * Returns the [elapsed] counter converted to milliseconds. |
| 45 */ | 57 */ |
| 46 int elapsedInMs(); | 58 int elapsedInMs(); |
| 47 | 59 |
| 48 /** | 60 /** |
| 49 * Returns the frequency of the elapsed counter in Hz. | 61 * Returns the frequency of the elapsed counter in Hz. |
| 50 */ | 62 */ |
| 51 int frequency(); | 63 int frequency(); |
| 52 | 64 |
| 53 } | 65 } |
| OLD | NEW |