Index: dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart |
diff --git a/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart |
index e84d45c15b1f15e92a1fdf2b013d2f8646884079..af5da25c6a2e2090b66dc79a4ca84e62ef18912b 100644 |
--- a/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart |
+++ b/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart |
@@ -100,23 +100,25 @@ class Compiler extends leg.Compiler { |
} |
leg.Script readScript(Uri uri, [tree.Node node]) { |
- if (uri.scheme == 'dart') uri = translateDartUri(uri, node); |
- var translated = translateUri(uri, node); |
- String text = ""; |
- try { |
- // TODO(ahe): We expect the future to be complete and call value |
- // directly. In effect, we don't support truly asynchronous API. |
- text = provider(translated).value; |
- } catch (exception) { |
- if (node != null) { |
- cancel("$exception", node: node); |
- } else { |
- reportDiagnostic(null, "$exception", api.Diagnostic.ERROR); |
- throw new leg.CompilerCancelledException("$exception"); |
+ return fileReadingTask.measure(() { |
+ if (uri.scheme == 'dart') uri = translateDartUri(uri, node); |
+ var translated = translateUri(uri, node); |
+ String text = ""; |
+ try { |
+ // TODO(ahe): We expect the future to be complete and call value |
+ // directly. In effect, we don't support truly asynchronous API. |
+ text = provider(translated).value; |
+ } catch (exception) { |
+ if (node != null) { |
+ cancel("$exception", node: node); |
+ } else { |
+ reportDiagnostic(null, "$exception", api.Diagnostic.ERROR); |
+ throw new leg.CompilerCancelledException("$exception"); |
+ } |
} |
- } |
- SourceFile sourceFile = new SourceFile(translated.toString(), text); |
- return new leg.Script(uri, sourceFile); |
+ SourceFile sourceFile = new SourceFile(translated.toString(), text); |
+ return new leg.Script(uri, sourceFile); |
+ }); |
} |
Uri translateUri(Uri uri, tree.Node node) { |
@@ -156,9 +158,14 @@ class Compiler extends leg.Compiler { |
bool run(Uri uri) { |
bool success = super.run(uri); |
+ int cumulated = 0; |
for (final task in tasks) { |
+ cumulated += task.timing; |
log('${task.name} took ${task.timing}msec'); |
} |
+ int total = totalCompileTime.elapsedMilliseconds; |
+ log('Total compile-time ${total}msec;' |
+ ' unaccounted ${total - cumulated}msec'); |
return success; |
} |