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

Unified Diff: pkg/analyzer/lib/src/generated/source_io.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/sdk_io.dart ('k') | pkg/analyzer/lib/src/generated/utilities_general.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/source_io.dart
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index b9d8067fa4e004b4cf0b577567af8e69f6c84fdd..fa87510ec4176c4ac8d1a0ce46a86302be91909e 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -11,6 +11,7 @@ import 'source.dart';
import 'java_core.dart';
import 'java_io.dart';
import 'utilities_general.dart';
+import 'instrumentation.dart';
import 'engine.dart';
export 'source.dart';
@@ -125,7 +126,7 @@ class FileBasedSource implements Source {
try {
return contentsFromFile;
} finally {
- handle.stop();
+ _reportIfSlowIO(handle.stop());
}
}
@@ -184,6 +185,22 @@ class FileBasedSource implements Source {
TimestampedData<String> get contentsFromFile {
return new TimestampedData<String>(file.lastModified(), file.readAsStringSync());
}
+
+ /**
+ * Record the time the IO took if it was slow
+ */
+ void _reportIfSlowIO(int nanos) {
+ //If slower than 10ms
+ if (nanos > 10 * TimeCounter.NANOS_PER_MILLI) {
+ InstrumentationBuilder builder = Instrumentation.builder2("SlowIO");
+ try {
+ builder.data3("fileName", fullName);
+ builder.metric2("IO-Time-Nanos", nanos);
+ } finally {
+ builder.log();
+ }
+ }
+ }
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer/lib/src/generated/utilities_general.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698