| 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();
|
| + }
|
| + }
|
| + }
|
| }
|
|
|
| /**
|
|
|