| Index: pkg/analyzer/lib/src/generated/utilities_general.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/utilities_general.dart b/pkg/analyzer/lib/src/generated/utilities_general.dart
|
| index 78089ec77194db4d45fe04cab36da7dde3397caf..f5531a42bfd63e1b9ae3bbb1c9660cbf89f925bc 100644
|
| --- a/pkg/analyzer/lib/src/generated/utilities_general.dart
|
| +++ b/pkg/analyzer/lib/src/generated/utilities_general.dart
|
| @@ -11,6 +11,8 @@ library engine.utilities.general;
|
| * Helper for measuring how much time is spent doing some operation.
|
| */
|
| class TimeCounter {
|
| + static final int NANOS_PER_MILLI = 1000 * 1000;
|
| + static final int NANOS_PER_MICRO = 1000;
|
| static TimeCounter _current = null;
|
| final Stopwatch _sw = new Stopwatch();
|
|
|
| @@ -34,6 +36,7 @@ class TimeCounter {
|
| */
|
| class TimeCounter_TimeCounterHandle {
|
| final TimeCounter _counter;
|
| + int _startMicros;
|
| TimeCounter _prev;
|
|
|
| TimeCounter_TimeCounterHandle(this._counter) {
|
| @@ -44,18 +47,23 @@ class TimeCounter_TimeCounterHandle {
|
| }
|
| TimeCounter._current = _counter;
|
| // start this counter
|
| + _startMicros = _counter._sw.elapsedMicroseconds;
|
| _counter._sw.start();
|
| }
|
|
|
| /**
|
| * Stops counting time and updates counter.
|
| */
|
| - void stop() {
|
| + int stop() {
|
| _counter._sw.stop();
|
| + int elapsed = (_counter._sw.elapsedMicroseconds - _startMicros) *
|
| + TimeCounter.NANOS_PER_MICRO;
|
| // restore previous counter and resume it
|
| TimeCounter._current = _prev;
|
| if (_prev != null) {
|
| _prev._sw.start();
|
| }
|
| + // done
|
| + return elapsed;
|
| }
|
| -}
|
| +}
|
|
|