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

Side by Side Diff: pkg/analyzer/lib/src/analyzer_impl.dart

Issue 918383002: Rework analysis server performance measurement code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/bin/analyzer.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer_impl; 5 library analyzer_impl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:io'; 9 import 'dart:io';
10 10
11 import 'package:analyzer/file_system/file_system.dart' show Folder; 11 import 'package:analyzer/file_system/file_system.dart' show Folder;
12 import 'package:analyzer/file_system/physical_file_system.dart'; 12 import 'package:analyzer/file_system/physical_file_system.dart';
13 import 'package:analyzer/source/package_map_provider.dart'; 13 import 'package:analyzer/source/package_map_provider.dart';
14 import 'package:analyzer/source/package_map_resolver.dart'; 14 import 'package:analyzer/source/package_map_resolver.dart';
15 import 'package:analyzer/source/pub_package_map_provider.dart'; 15 import 'package:analyzer/source/pub_package_map_provider.dart';
16 import 'package:analyzer/src/error_formatter.dart'; 16 import 'package:analyzer/src/error_formatter.dart';
17 import 'package:analyzer/src/generated/java_core.dart' show JavaSystem; 17 import 'package:analyzer/src/generated/java_core.dart' show JavaSystem;
18 import 'package:analyzer/src/generated/java_engine.dart'; 18 import 'package:analyzer/src/generated/java_engine.dart';
19 19
20 import '../options.dart'; 20 import '../options.dart';
21 import 'generated/constant.dart'; 21 import 'generated/constant.dart';
22 import 'generated/element.dart'; 22 import 'generated/element.dart';
23 import 'generated/engine.dart'; 23 import 'generated/engine.dart';
24 import 'generated/error.dart'; 24 import 'generated/error.dart';
25 import 'generated/java_io.dart'; 25 import 'generated/java_io.dart';
26 import 'generated/sdk_io.dart'; 26 import 'generated/sdk_io.dart';
27 import 'generated/source_io.dart'; 27 import 'generated/source_io.dart';
28 import 'package:analyzer/src/generated/utilities_general.dart';
28 29
29 DirectoryBasedDartSdk sdk; 30 DirectoryBasedDartSdk sdk;
30 31
31 /** 32 /**
32 * The maximum number of sources for which AST structures should be kept in the cache. 33 * The maximum number of sources for which AST structures should be kept in the cache.
33 */ 34 */
34 const int _MAX_CACHE_SIZE = 512; 35 const int _MAX_CACHE_SIZE = 512;
35 36
36 /// Analyzes single library [File]. 37 /// Analyzes single library [File].
37 class AnalyzerImpl { 38 class AnalyzerImpl {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 ErrorSeverity.INFO && 293 ErrorSeverity.INFO &&
293 options.disableHints) { 294 options.disableHints) {
294 return false; 295 return false;
295 } 296 }
296 return true; 297 return true;
297 } 298 }
298 299
299 _printColdPerf() { 300 _printColdPerf() {
300 // print cold VM performance numbers 301 // print cold VM performance numbers
301 int totalTime = JavaSystem.currentTimeMillis() - startTime; 302 int totalTime = JavaSystem.currentTimeMillis() - startTime;
302 int ioTime = PerformanceStatistics.io.result; 303 int otherTime = totalTime;
303 int scanTime = PerformanceStatistics.scan.result; 304 for (PerformanceTag tag in PerformanceTag.all) {
304 int parseTime = PerformanceStatistics.parse.result; 305 if (tag != PerformanceTag.UNKNOWN) {
305 int resolveTime = PerformanceStatistics.resolve.result; 306 int tagTime = tag.elapsedMs;
306 int errorsTime = PerformanceStatistics.errors.result; 307 stdout.writeln('${tag.label}-cold:$tagTime');
307 int hintsTime = PerformanceStatistics.hints.result; 308 otherTime -= tagTime;
308 stdout.writeln("io-cold:$ioTime"); 309 }
309 stdout.writeln("scan-cold:$scanTime"); 310 }
310 stdout.writeln("parse-cold:$parseTime"); 311 stdout.writeln('other-cold:$otherTime');
311 stdout.writeln("resolve-cold:$resolveTime");
312 stdout.writeln("errors-cold:$errorsTime");
313 stdout.writeln("hints-cold:$hintsTime");
314 stdout.writeln("other-cold:${totalTime
315 - (ioTime + scanTime + parseTime + resolveTime + errorsTime + hintsTime) }");
316 stdout.writeln("total-cold:$totalTime"); 312 stdout.writeln("total-cold:$totalTime");
317 } 313 }
318 314
319 _printErrorsAndPerf() { 315 _printErrorsAndPerf() {
320 // The following is a hack. We currently print out to stderr to ensure that 316 // The following is a hack. We currently print out to stderr to ensure that
321 // when in batch mode we print to stderr, this is because the prints from 317 // when in batch mode we print to stderr, this is because the prints from
322 // batch are made to stderr. The reason that options.shouldBatch isn't used 318 // batch are made to stderr. The reason that options.shouldBatch isn't used
323 // is because when the argument flags are constructed in BatchRunner and 319 // is because when the argument flags are constructed in BatchRunner and
324 // passed in from batch mode which removes the batch flag to prevent the 320 // passed in from batch mode which removes the batch flag to prevent the
325 // "cannot have the batch flag and source file" error message. 321 // "cannot have the batch flag and source file" error message.
326 IOSink sink = options.machineFormat ? stderr : stdout; 322 IOSink sink = options.machineFormat ? stderr : stdout;
327 323
328 // print errors 324 // print errors
329 ErrorFormatter formatter = 325 ErrorFormatter formatter =
330 new ErrorFormatter(sink, options, _isDesiredError); 326 new ErrorFormatter(sink, options, _isDesiredError);
331 formatter.formatErrors(errorInfos); 327 formatter.formatErrors(errorInfos);
332 328
333 // print performance numbers 329 // print performance numbers
334 if (options.perf || options.warmPerf) { 330 if (options.perf || options.warmPerf) {
335 int totalTime = JavaSystem.currentTimeMillis() - startTime; 331 int totalTime = JavaSystem.currentTimeMillis() - startTime;
336 int ioTime = PerformanceStatistics.io.result; 332 int otherTime = totalTime;
337 int scanTime = PerformanceStatistics.scan.result; 333 for (PerformanceTag tag in PerformanceTag.all) {
338 int parseTime = PerformanceStatistics.parse.result; 334 if (tag != PerformanceTag.UNKNOWN) {
339 int resolveTime = PerformanceStatistics.resolve.result; 335 int tagTime = tag.elapsedMs;
340 int errorsTime = PerformanceStatistics.errors.result; 336 stdout.writeln('${tag.label}:$tagTime');
341 int hintsTime = PerformanceStatistics.hints.result; 337 otherTime -= tagTime;
342 stdout.writeln("io:$ioTime"); 338 }
343 stdout.writeln("scan:$scanTime"); 339 }
344 stdout.writeln("parse:$parseTime"); 340 stdout.writeln('other:$otherTime');
345 stdout.writeln("resolve:$resolveTime");
346 stdout.writeln("errors:$errorsTime");
347 stdout.writeln("hints:$hintsTime");
348 stdout.writeln("other:${totalTime
349 - (ioTime + scanTime + parseTime + resolveTime + errorsTime + hintsTim e)}");
350 stdout.writeln("total:$totalTime"); 341 stdout.writeln("total:$totalTime");
351 } 342 }
352 } 343 }
353 344
354 /** 345 /**
355 * Compute the severity of the error; however, if 346 * Compute the severity of the error; however, if
356 * [enableTypeChecks] is false, then de-escalate checked-mode compile time 347 * [enableTypeChecks] is false, then de-escalate checked-mode compile time
357 * errors to a severity of [ErrorSeverity.INFO]. 348 * errors to a severity of [ErrorSeverity.INFO].
358 */ 349 */
359 static ErrorSeverity computeSeverity(AnalysisError error, 350 static ErrorSeverity computeSeverity(AnalysisError error,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 430 }
440 } 431 }
441 432
442 @override 433 @override
443 void logInformation2(String message, Object exception) { 434 void logInformation2(String message, Object exception) {
444 if (log) { 435 if (log) {
445 stdout.writeln(message); 436 stdout.writeln(message);
446 } 437 }
447 } 438 }
448 } 439 }
OLDNEW
« no previous file with comments | « pkg/analyzer/bin/analyzer.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698