From 001c107858860f9e751237540dd372ee9fe73a27 Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Tue, 12 Jan 2016 09:03:44 -0800 Subject: [PATCH] Teach analyze how to print out the total time spent Makes it more obvious that flutter analyze takes a long time. @Hixie --- packages/flutter_tools/lib/src/commands/analyze.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index fe034219ed..6ac6a55e3f 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart @@ -30,6 +30,7 @@ class AnalyzeCommand extends FlutterCommand { @override Future runInProject() async { + Stopwatch stopwatch = new Stopwatch()..start(); Set pubSpecDirectories = new Set(); List dartFiles = argResults.rest.toList(); @@ -322,14 +323,16 @@ class AnalyzeCommand extends FlutterCommand { errorCount += 1; } } + stopwatch.stop(); + String elapsed = (stopwatch.elapsedMilliseconds / 100.0).toStringAsFixed(1); if (exitCode < 0 || exitCode > 3) // 0 = nothing, 1 = hints, 2 = warnings, 3 = errors return exitCode; if (errorCount > 0) - return 1; + return 1; // Doesn't this mean 'hints' per the above comment? if (argResults['congratulate']) - print('No analyzer warnings!'); + print('No analyzer warnings! (ran in ${elapsed}s)'); return 0; } }