Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: pkg/analyzer/lib/src/generated/utilities_general.dart

Issue 263913003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/source_io.dart ('k') | pkg/analyzer/lib/src/services/formatter_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
-}
+}
« no previous file with comments | « pkg/analyzer/lib/src/generated/source_io.dart ('k') | pkg/analyzer/lib/src/services/formatter_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698