OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.utilities.general; | 8 library engine.utilities.general; |
9 | 9 |
10 /** | 10 /** |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // start this counter | 49 // start this counter |
50 _startMicros = _counter._sw.elapsedMicroseconds; | 50 _startMicros = _counter._sw.elapsedMicroseconds; |
51 _counter._sw.start(); | 51 _counter._sw.start(); |
52 } | 52 } |
53 | 53 |
54 /** | 54 /** |
55 * Stops counting time and updates counter. | 55 * Stops counting time and updates counter. |
56 */ | 56 */ |
57 int stop() { | 57 int stop() { |
58 _counter._sw.stop(); | 58 _counter._sw.stop(); |
59 int elapsed = (_counter._sw.elapsedMicroseconds - _startMicros) * | 59 int elapsed = |
| 60 (_counter._sw.elapsedMicroseconds - _startMicros) * |
60 TimeCounter.NANOS_PER_MICRO; | 61 TimeCounter.NANOS_PER_MICRO; |
61 // restore previous counter and resume it | 62 // restore previous counter and resume it |
62 TimeCounter._current = _prev; | 63 TimeCounter._current = _prev; |
63 if (_prev != null) { | 64 if (_prev != null) { |
64 _prev._sw.start(); | 65 _prev._sw.start(); |
65 } | 66 } |
66 // done | 67 // done |
67 return elapsed; | 68 return elapsed; |
68 } | 69 } |
69 } | 70 } |
OLD | NEW |