Chromium Code Reviews| Index: editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java |
| diff --git a/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java b/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java |
| index e66f70293d4169ab0dd48b603cccd18df97216bf..56933db17f29afab71cf87809301f82f51ae23dc 100644 |
| --- a/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java |
| +++ b/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java |
| @@ -194,6 +194,29 @@ public class AnalyzerMain { |
| formatter.startAnalysis(); |
| + if (options.getWarmPerf()) { |
| + long startTime = System.currentTimeMillis(); |
| + AnalyzerImpl analyzer = newAnalyzer(options); |
| + analyzer.analyze(sourceFile, errors, lineInfoMap); |
| + showColdPerformanceResults(startTime); |
| + |
| + for (int i = 0; i < 8; i++) { |
| + analyzer = newAnalyzer(options); |
| + analyzer.analyze(sourceFile, errors, lineInfoMap); |
| + } |
| + |
| + PerformanceStatistics.reset(); |
| + startTime = System.currentTimeMillis(); |
| + analyzer = newAnalyzer(options); |
| + ErrorSeverity status = analyzer.analyze(sourceFile, errors, lineInfoMap); |
| + formatter.formatErrors(errors); |
| + if (status.equals(ErrorSeverity.WARNING) && options.getWarningsAreFatal()) { |
| + status = ErrorSeverity.ERROR; |
| + } |
| + showPerformanceResults(startTime); |
| + return status; |
| + } |
| + |
| long startTime = System.currentTimeMillis(); |
| AnalyzerImpl analyzer = newAnalyzer(options); |
| ErrorSeverity status = analyzer.analyze(sourceFile, errors, lineInfoMap); |
| @@ -235,6 +258,30 @@ public class AnalyzerMain { |
| System.out.println("total:" + totalTime); |
| } |
| + private void showColdPerformanceResults(long startTime) { |
|
scheglov
2014/04/07 19:20:30
Maybe pass "-cold" prefix and shared code with "wa
Brian Wilkerson
2014/04/07 20:05:17
Done
|
| + long totalTime = System.currentTimeMillis() - startTime; |
| + long ioTime = PerformanceStatistics.io.getResult(); |
| + long scanTime = PerformanceStatistics.scan.getResult(); |
| + long parseTime = PerformanceStatistics.parse.getResult(); |
| + long resolveTime = PerformanceStatistics.resolve.getResult(); |
| + long errorsTime = PerformanceStatistics.errors.getResult(); |
| + long hintsTime = PerformanceStatistics.hints.getResult(); |
| + long angularTime = PerformanceStatistics.angular.getResult(); |
| + long polymerTime = PerformanceStatistics.polymer.getResult(); |
| + System.out.println("io-cold:" + ioTime); |
| + System.out.println("scan-cold:" + scanTime); |
| + System.out.println("parse-cold:" + parseTime); |
| + System.out.println("resolve-cold:" + resolveTime); |
| + System.out.println("errors-cold:" + errorsTime); |
| + System.out.println("hints-cold:" + hintsTime); |
| + System.out.println("angular-cold:" + angularTime); |
| + System.out.println("polymer-cold:" + polymerTime); |
| + System.out.println("other-cold:" |
| + + (totalTime - (ioTime + scanTime + parseTime + resolveTime + errorsTime + hintsTime |
| + + angularTime + polymerTime))); |
| + System.out.println("total-cold:" + totalTime); |
| + } |
| + |
| private void showUsage(PrintStream out) { |
| out.println("Usage: " + getProgramName() + " [<options>] <dart-script>"); |
| out.println(); |