| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * A simple [Stopwatch] interface to measure elapsed time. | |
| 7 */ | |
| 8 interface Stopwatch default StopwatchImplementation { | |
| 9 | |
| 10 /** | |
| 11 * Creates a [Stopwatch] in stopped state with a zero elapsed count. | |
| 12 */ | |
| 13 Stopwatch(); | |
| 14 | |
| 15 /** | |
| 16 * Creates a [Stopwatch] in started state with a zero elapsed count. | |
| 17 */ | |
| 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. | |
| 25 */ | |
| 26 void start(); | |
| 27 | |
| 28 /** | |
| 29 * Stops the [Stopwatch]. The [elapsed] count stops increasing. | |
| 30 * If the [Stopwatch] is currently not running, then calling stop does | |
| 31 * nothing. | |
| 32 */ | |
| 33 void stop(); | |
| 34 | |
| 35 /** | |
| 36 * Resets the [elapsed] count to zero. This method does not stop or start | |
| 37 * the [Stopwatch]. | |
| 38 */ | |
| 39 void reset(); | |
| 40 | |
| 41 /** | |
| 42 * Returns the elapsed number of clock ticks since calling [start] while the | |
| 43 * [Stopwatch] is running. | |
| 44 * Returns the elapsed number of clock ticks between calling [start] and | |
| 45 * calling [stop]. | |
| 46 * Returns 0 if the [Stopwatch] has never been started. | |
| 47 * The elapsed number of clock ticks increases by [frequency] every second. | |
| 48 */ | |
| 49 int elapsed(); | |
| 50 | |
| 51 /** | |
| 52 * Returns the [elapsed] counter converted to microseconds. | |
| 53 */ | |
| 54 int elapsedInUs(); | |
| 55 | |
| 56 /** | |
| 57 * Returns the [elapsed] counter converted to milliseconds. | |
| 58 */ | |
| 59 int elapsedInMs(); | |
| 60 | |
| 61 /** | |
| 62 * Returns the frequency of the elapsed counter in Hz. | |
| 63 */ | |
| 64 int frequency(); | |
| 65 | |
| 66 } | |
| OLD | NEW |