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

Side by Side Diff: pkg/analyzer/lib/src/services/lint.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/lib/src/generated/utilities_general.dart ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 lint; 5 library lint;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/utilities_general.dart'; 8 import 'package:analyzer/src/generated/utilities_general.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 24 matching lines...) Expand all
35 35
36 final Iterable<CompilationUnit> _compilationUnits; 36 final Iterable<CompilationUnit> _compilationUnits;
37 final AnalysisErrorListener _errorListener; 37 final AnalysisErrorListener _errorListener;
38 final Iterable<Linter> _linters; 38 final Iterable<Linter> _linters;
39 39
40 LintGenerator(this._compilationUnits, this._errorListener, 40 LintGenerator(this._compilationUnits, this._errorListener,
41 [Iterable<Linter> linters]) 41 [Iterable<Linter> linters])
42 : _linters = linters != null ? linters : LINTERS; 42 : _linters = linters != null ? linters : LINTERS;
43 43
44 void generate() { 44 void generate() {
45 TimeCounter_TimeCounterHandle timeCounter = 45 PerformanceTag prevTag = PerformanceStatistics.lint.makeCurrent();
46 PerformanceStatistics.lint.start();
47 try { 46 try {
48 _compilationUnits.forEach((cu) { 47 _compilationUnits.forEach((cu) {
49 if (cu.element != null) { 48 if (cu.element != null) {
50 _generate(cu, cu.element.source); 49 _generate(cu, cu.element.source);
51 } 50 }
52 }); 51 });
53 } finally { 52 } finally {
54 timeCounter.stop(); 53 prevTag.makeCurrent();
55 } 54 }
56 } 55 }
57 56
58 void _generate(CompilationUnit unit, Source source) { 57 void _generate(CompilationUnit unit, Source source) {
59 ErrorReporter errorReporter = new ErrorReporter(_errorListener, source); 58 ErrorReporter errorReporter = new ErrorReporter(_errorListener, source);
60 _linters.forEach((l) => l.reporter = errorReporter); 59 _linters.forEach((l) => l.reporter = errorReporter);
61 Iterable<AstVisitor> visitors = _linters.map((l) => l.getVisitor()); 60 Iterable<AstVisitor> visitors = _linters.map((l) => l.getVisitor());
62 unit.accept(new DelegatingAstVisitor(visitors.where((v) => v != null))); 61 unit.accept(new DelegatingAstVisitor(visitors.where((v) => v != null)));
63 } 62 }
64 } 63 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/utilities_general.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698