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

Unified Diff: dart/site/try/poi/poi.dart

Issue 626853002: Add PoiTask to better measure timing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/poi/poi.dart
diff --git a/dart/site/try/poi/poi.dart b/dart/site/try/poi/poi.dart
index d7ae82d33a22666a1c4d8b90cd22cca37a06fd53..70e726dd6ae1f4ac19549fe04a290f967c1fabd2 100644
--- a/dart/site/try/poi/poi.dart
+++ b/dart/site/try/poi/poi.dart
@@ -26,6 +26,7 @@ import 'package:compiler/compiler.dart' as api;
import 'package:compiler/implementation/dart2jslib.dart' show
Compiler,
+ CompilerTask,
Enqueuer,
QueueFilter,
WorkItem;
@@ -95,6 +96,8 @@ const bool PRINT_SCOPE_INFO =
Stopwatch wallClock = new Stopwatch();
+PoiTask poiTask;
+
Compiler cachedCompiler;
/// Iterator for reading lines from [io.stdin].
@@ -370,6 +373,9 @@ Future<Element> runPoi(
LibraryUpdater updater =
new LibraryUpdater(
cachedCompiler, inputProvider, script, printWallClock, printVerbose);
+ Future<bool> reuseLibrary(LibraryElement library) {
+ return poiTask.measure(() => updater.reuseLibrary(library));
+ }
return reuseCompiler(
diagnosticHandler: handler,
@@ -379,7 +385,7 @@ Future<Element> runPoi(
libraryRoot: libraryRoot,
packageRoot: packageRoot,
packagesAreImmutable: true,
- reuseLibrary: updater.reuseLibrary).then((Compiler newCompiler) {
+ reuseLibrary: reuseLibrary).then((Compiler newCompiler) {
var filter = new ScriptOnlyFilter(script);
newCompiler.enqueuerFilter = filter;
return runPoiInternal(newCompiler, updater, position);
@@ -390,7 +396,12 @@ Future<Element> runPoiInternal(
Compiler newCompiler,
LibraryUpdater updater,
int position) {
+
cachedCompiler = newCompiler;
+ if (poiTask == null || poiTask.compiler != cachedCompiler) {
+ poiTask = new PoiTask(cachedCompiler);
+ cachedCompiler.tasks.add(poiTask);
+ }
Future<bool> compilation = cachedCompiler.run(updater.uri);
@@ -725,3 +736,9 @@ modelx.ScopeX localScope(modelx.LibraryElementX element) => element.localScope;
modelx.ImportScope importScope(modelx.LibraryElementX element) {
return element.importScope;
}
+
+class PoiTask extends CompilerTask {
+ PoiTask(Compiler compiler) : super(compiler);
+
+ String get name => 'POI';
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698