Add timing info for file IO into Dart based analyzer.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//179123010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33191 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com 2014-03-01 19:47:36 +00:00
parent 99a74be0f8
commit 79e687be71
4 changed files with 25 additions and 5 deletions

View file

@ -33,12 +33,14 @@ void main(args) {
if (options.perf) {
int totalTime = JavaSystem.currentTimeMillis() - startTime;
int ioTime = PerformanceStatistics.io.result;
int scanTime = PerformanceStatistics.scan.result;
int parseTime = PerformanceStatistics.parse.result;
int resolveTime = PerformanceStatistics.resolve.result;
int errorsTime = PerformanceStatistics.errors.result;
int hintsTime = PerformanceStatistics.hints.result;
int angularTime = PerformanceStatistics.angular.result;
print("io:$ioTime");
print("scan:$scanTime");
print("parse:$parseTime");
print("resolve:$resolveTime");
@ -46,7 +48,7 @@ void main(args) {
print("hints:$hintsTime");
print("angular:$angularTime");
print("other:${totalTime
- (scanTime + parseTime + resolveTime + errorsTime + hintsTime
- (ioTime + scanTime + parseTime + resolveTime + errorsTime + hintsTime
+ angularTime)}");
print("total:$totalTime");
print("");

View file

@ -8600,6 +8600,11 @@ class PerformanceStatistics {
*/
static TimeCounter angular = new TimeCounter();
/**
* The [TimeCounter] for time spent in reading files.
*/
static TimeCounter io = new TimeCounter();
/**
* The [TimeCounter] for time spent in scanning.
*/

View file

@ -10,7 +10,8 @@ library engine.source.io;
import 'source.dart';
import 'java_core.dart';
import 'java_io.dart';
import 'engine.dart' show AnalysisContext, AnalysisEngine, TimestampedData;
import 'engine.dart';
import 'utilities_general.dart';
export 'source.dart';
/**
@ -101,10 +102,22 @@ class FileBasedSource implements Source {
bool exists() => _file.isFile();
TimestampedData<String> get contents => contentsFromFile;
TimestampedData<String> get contents {
TimeCounter_TimeCounterHandle handle = PerformanceStatistics.io.start();
try {
return contentsFromFile;
} finally {
handle.stop();
}
}
void getContentsToReceiver(Source_ContentReceiver receiver) {
getContentsFromFileToReceiver(receiver);
TimeCounter_TimeCounterHandle handle = PerformanceStatistics.io.start();
try {
getContentsFromFileToReceiver(receiver);
} finally {
handle.stop();
}
}
String get encoding {

View file

@ -1,5 +1,5 @@
name: analyzer
version: 0.13.0-dev
version: 0.13.0-dev.1
author: Dart Team <misc@dartlang.org>
description: Static analyzer for Dart.
homepage: http://www.dartlang.org