Move PerformanceLogger to package:analyzer
Change-Id: I89a60ae9ab639c7907a92976e1eb8007d0f4ee9b
Reviewed-on: https://dart-review.googlesource.com/c/77760
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 001e904..38cc3ad 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -69,7 +69,7 @@
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
import 'package:analyzer_plugin/src/utilities/navigation/navigation.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:telemetry/crash_reporting.dart';
import 'package:telemetry/telemetry.dart' as telemetry;
import 'package:watcher/watcher.dart';
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 40a157d..95ca1a7 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -21,7 +21,7 @@
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'mock_sdk.dart';
import 'src/utilities/flutter_util.dart';
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 44ddb72..8d5659e 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -25,7 +25,7 @@
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:analyzer/src/util/glob.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:linter/src/rules.dart';
import 'package:linter/src/rules/avoid_as.dart';
import 'package:path/path.dart' as path;
diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart
index c8a7acf..b0f0dde 100644
--- a/pkg/analysis_server/test/services/search/search_engine_test.dart
+++ b/pkg/analysis_server/test/services/search/search_engine_test.dart
@@ -16,7 +16,7 @@
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart b/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
index fde7e3f..69c8408 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
@@ -19,7 +19,7 @@
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index bf346d0..8315664 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -35,7 +35,7 @@
import 'package:analyzer/src/util/uri.dart';
import 'package:args/args.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:package_config/packages.dart';
import 'package:package_config/packages_file.dart';
import 'package:package_config/src/packages_impl.dart';
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
index c6f1caf..4978734 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
@@ -19,7 +19,8 @@
import 'package:analyzer/src/dart/sdk/sdk.dart';
import 'package:analyzer/src/generated/sdk.dart' show DartSdkManager;
import 'package:analyzer/src/generated/source.dart' show ContentCache;
-import 'package:front_end/src/base/performance_logger.dart' show PerformanceLog;
+import 'package:analyzer/src/dart/analysis/performance_logger.dart'
+ show PerformanceLog;
import 'package:front_end/src/byte_store/byte_store.dart'
show ByteStore, MemoryByteStore;
import 'package:meta/meta.dart';
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
index 5f36fcb..a0f0153 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
@@ -22,7 +22,8 @@
import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk;
import 'package:analyzer/src/generated/sdk.dart' show DartSdkManager;
import 'package:analyzer/src/generated/source.dart' show ContentCache;
-import 'package:front_end/src/base/performance_logger.dart' show PerformanceLog;
+import 'package:analyzer/src/dart/analysis/performance_logger.dart'
+ show PerformanceLog;
import 'package:front_end/src/byte_store/byte_store.dart' show MemoryByteStore;
import 'package:meta/meta.dart';
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index ec11001..f73461a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -43,7 +43,7 @@
import 'package:analyzer/src/summary/package_bundle_reader.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
import 'package:analyzer/src/summary/api_signature.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:meta/meta.dart';
/**
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index da94d43..6bd09b9 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -31,7 +31,7 @@
import 'package:crypto/crypto.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
import 'package:analyzer/src/summary/api_signature.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:front_end/src/fasta/scanner/token.dart';
import 'package:meta/meta.dart';
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
index 6c08079..c49cf71 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
@@ -5,7 +5,7 @@
import 'dart:collection';
import 'package:analyzer/src/dart/analysis/file_state.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
/**
* Callback used by [FileTracker] to report to its client that files have been
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_context.dart b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
index 559ed4d..c0fef6f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
@@ -22,7 +22,7 @@
import 'package:analyzer/src/summary/package_bundle_reader.dart';
import 'package:analyzer/src/summary/summarize_elements.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
/**
* Context information necessary to analyze one or more libraries within an
diff --git a/pkg/analyzer/lib/src/dart/analysis/performance_logger.dart b/pkg/analyzer/lib/src/dart/analysis/performance_logger.dart
index 9e5ad9a..47af4cd 100644
--- a/pkg/analyzer/lib/src/dart/analysis/performance_logger.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/performance_logger.dart
@@ -1,8 +1,91 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// This library re-exports the parts of front_end's performance_logger.dart
-// whose API is stable enough to be relied upon by clients.
+import 'dart:async';
-export 'package:front_end/src/base/performance_logger.dart' show PerformanceLog;
+/// This class is used to gather and print performance information.
+class PerformanceLog {
+ final StringSink sink;
+ int _level = 0;
+
+ PerformanceLog(this.sink);
+
+ /// Enter a new execution section, which starts at one point of code, runs
+ /// some time, and then ends at the other point of code.
+ ///
+ /// The client must call [PerformanceLogSection.exit] for every [enter].
+ PerformanceLogSection enter(String msg) {
+ writeln('+++ $msg.');
+ _level++;
+ return new PerformanceLogSection(this, msg);
+ }
+
+ /// Return the result of the function [f] invocation and log the elapsed time.
+ ///
+ /// Each invocation of [run] creates a new enclosed section in the log,
+ /// which begins with printing [msg], then any log output produced during
+ /// [f] invocation, and ends with printing [msg] with the elapsed time.
+ T run<T>(String msg, T f()) {
+ Stopwatch timer = new Stopwatch()..start();
+ try {
+ writeln('+++ $msg.');
+ _level++;
+ return f();
+ } finally {
+ _level--;
+ int ms = timer.elapsedMilliseconds;
+ writeln('--- $msg in $ms ms.');
+ }
+ }
+
+ /// Return the result of the function [f] invocation and log the elapsed time.
+ ///
+ /// Each invocation of [run] creates a new enclosed section in the log,
+ /// which begins with printing [msg], then any log output produced during
+ /// [f] invocation, and ends with printing [msg] with the elapsed time.
+ Future<T> runAsync<T>(String msg, Future<T> f()) async {
+ Stopwatch timer = new Stopwatch()..start();
+ try {
+ writeln('+++ $msg.');
+ _level++;
+ return await f();
+ } finally {
+ _level--;
+ int ms = timer.elapsedMilliseconds;
+ writeln('--- $msg in $ms ms.');
+ }
+ }
+
+ /// Write a new line into the log.
+ void writeln(String msg) {
+ if (sink != null) {
+ String indent = '\t' * _level;
+ sink.writeln('$indent$msg');
+ }
+ }
+}
+
+/**
+ * The performance measurement section for operations that start and end
+ * at different place in code, so cannot be run using [PerformanceLog.run].
+ *
+ * The client must call [exit] for every [PerformanceLog.enter].
+ */
+class PerformanceLogSection {
+ final PerformanceLog _logger;
+ final String _msg;
+ final Stopwatch _timer = new Stopwatch()..start();
+
+ PerformanceLogSection(this._logger, this._msg);
+
+ /**
+ * Stop the timer, log the time.
+ */
+ void exit() {
+ _timer.stop();
+ _logger._level--;
+ int ms = _timer.elapsedMilliseconds;
+ _logger.writeln('--- $_msg in $ms ms.');
+ }
+}
diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart
index c669bd0..4baf120 100644
--- a/pkg/analyzer/lib/src/lint/analysis.dart
+++ b/pkg/analyzer/lib/src/lint/analysis.dart
@@ -26,7 +26,7 @@
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/util/sdk.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:package_config/packages.dart' show Packages;
import 'package:package_config/packages_file.dart' as pkgfile show parse;
import 'package:package_config/src/packages_impl.dart' show MapPackages;
diff --git a/pkg/analyzer/test/generated/resolver_test_case.dart b/pkg/analyzer/test/generated/resolver_test_case.dart
index 8dabb4a..acfb679 100644
--- a/pkg/analyzer/test/generated/resolver_test_case.dart
+++ b/pkg/analyzer/test/generated/resolver_test_case.dart
@@ -27,7 +27,7 @@
import 'package:analyzer/src/generated/testing/element_factory.dart';
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:test/test.dart';
import '../src/context/mock_sdk.dart';
diff --git a/pkg/analyzer/test/src/dart/analysis/base.dart b/pkg/analyzer/test/src/dart/analysis/base.dart
index a3f21c0..d3f0b3f 100644
--- a/pkg/analyzer/test/src/dart/analysis/base.dart
+++ b/pkg/analyzer/test/src/dart/analysis/base.dart
@@ -17,7 +17,7 @@
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/summary/package_bundle_reader.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:test/test.dart';
import '../../context/mock_sdk.dart';
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index c00aaad..adbf145 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -25,7 +25,7 @@
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary/package_bundle_reader.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
index 4050341..421fe06 100644
--- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
@@ -17,7 +17,7 @@
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart b/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart
index cab795a..99b9c64 100644
--- a/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/unlinked_api_signature_test.dart
@@ -13,7 +13,7 @@
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
index cc3a74b..1ec0712 100644
--- a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
+++ b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
@@ -24,7 +24,7 @@
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:source_span/source_span.dart';
import 'package:test/test.dart';
diff --git a/pkg/analyzer/tool/task_dependency_graph/generate.dart b/pkg/analyzer/tool/task_dependency_graph/generate.dart
index 5d2d7d9..07a3aa5 100644
--- a/pkg/analyzer/tool/task_dependency_graph/generate.dart
+++ b/pkg/analyzer/tool/task_dependency_graph/generate.dart
@@ -36,7 +36,7 @@
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/testing/package_root.dart' as package_root;
import 'package:path/path.dart' as path;
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index d6ac604..0ae6459 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -35,7 +35,7 @@
import 'package:collection/collection.dart';
import 'package:convert/convert.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:front_end/src/byte_store/cache.dart';
/**
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 6777a56..e4a29f9 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -44,7 +44,7 @@
import 'package:analyzer_cli/src/perf_report.dart';
import 'package:analyzer_cli/starter.dart' show CommandLineStarter;
import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/base/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:linter/src/rules.dart' as linter;
import 'package:meta/meta.dart';
import 'package:package_config/discovery.dart' as pkg_discovery;
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index 42dce2b..865c71e 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -6,8 +6,6 @@
import 'package:kernel/target/targets.dart' show Target;
-import '../base/performance_logger.dart' show PerformanceLog;
-
import '../fasta/fasta_codes.dart' show FormattedMessage;
import '../fasta/severity.dart' show Severity;
@@ -135,9 +133,6 @@
/// The byte storage to access serialized data.
ByteStore byteStore = new NullByteStore();
- /// The logger to report compilation progress.
- PerformanceLog logger = new PerformanceLog(new StringBuffer());
-
/// Whether to generate code for the SDK.
///
/// By default the front end resolves components using a prebuilt SDK summary.
diff --git a/pkg/front_end/lib/src/base/performance_logger.dart b/pkg/front_end/lib/src/base/performance_logger.dart
index 47af4cd..f7abd90 100644
--- a/pkg/front_end/lib/src/base/performance_logger.dart
+++ b/pkg/front_end/lib/src/base/performance_logger.dart
@@ -1,91 +1,11 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
+/// This is deprecated, please use
+/// `package:analyzer/src/dart/analysis/performance_logger.dart` instead.
+@deprecated
+library front_end.performance_logger;
-/// This class is used to gather and print performance information.
-class PerformanceLog {
- final StringSink sink;
- int _level = 0;
-
- PerformanceLog(this.sink);
-
- /// Enter a new execution section, which starts at one point of code, runs
- /// some time, and then ends at the other point of code.
- ///
- /// The client must call [PerformanceLogSection.exit] for every [enter].
- PerformanceLogSection enter(String msg) {
- writeln('+++ $msg.');
- _level++;
- return new PerformanceLogSection(this, msg);
- }
-
- /// Return the result of the function [f] invocation and log the elapsed time.
- ///
- /// Each invocation of [run] creates a new enclosed section in the log,
- /// which begins with printing [msg], then any log output produced during
- /// [f] invocation, and ends with printing [msg] with the elapsed time.
- T run<T>(String msg, T f()) {
- Stopwatch timer = new Stopwatch()..start();
- try {
- writeln('+++ $msg.');
- _level++;
- return f();
- } finally {
- _level--;
- int ms = timer.elapsedMilliseconds;
- writeln('--- $msg in $ms ms.');
- }
- }
-
- /// Return the result of the function [f] invocation and log the elapsed time.
- ///
- /// Each invocation of [run] creates a new enclosed section in the log,
- /// which begins with printing [msg], then any log output produced during
- /// [f] invocation, and ends with printing [msg] with the elapsed time.
- Future<T> runAsync<T>(String msg, Future<T> f()) async {
- Stopwatch timer = new Stopwatch()..start();
- try {
- writeln('+++ $msg.');
- _level++;
- return await f();
- } finally {
- _level--;
- int ms = timer.elapsedMilliseconds;
- writeln('--- $msg in $ms ms.');
- }
- }
-
- /// Write a new line into the log.
- void writeln(String msg) {
- if (sink != null) {
- String indent = '\t' * _level;
- sink.writeln('$indent$msg');
- }
- }
-}
-
-/**
- * The performance measurement section for operations that start and end
- * at different place in code, so cannot be run using [PerformanceLog.run].
- *
- * The client must call [exit] for every [PerformanceLog.enter].
- */
-class PerformanceLogSection {
- final PerformanceLog _logger;
- final String _msg;
- final Stopwatch _timer = new Stopwatch()..start();
-
- PerformanceLogSection(this._logger, this._msg);
-
- /**
- * Stop the timer, log the time.
- */
- void exit() {
- _timer.stop();
- _logger._level--;
- int ms = _timer.elapsedMilliseconds;
- _logger.writeln('--- $_msg in $ms ms.');
- }
-}
+export 'package:analyzer/src/dart/analysis/performance_logger.dart'
+ show PerformanceLog;
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 051bf5a..b47bfae 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -30,8 +30,6 @@
import '../api_prototype/file_system.dart'
show FileSystem, FileSystemEntity, FileSystemException;
-import '../base/performance_logger.dart' show PerformanceLog;
-
import '../fasta/command_line_reporting.dart' as command_line_reporting;
import '../fasta/fasta_codes.dart'
@@ -183,11 +181,6 @@
// collecting time since the start of the VM.
this.ticker = new Ticker(isVerbose: options?.verbose ?? false);
- /// The logger to report compilation progress.
- PerformanceLog get logger {
- return _raw.logger;
- }
-
/// The byte storage to get and put serialized data.
ByteStore get byteStore {
return _raw.byteStore;
diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml
index 0fdbbb9..0ea3c61 100644
--- a/pkg/front_end/pubspec.yaml
+++ b/pkg/front_end/pubspec.yaml
@@ -17,8 +17,10 @@
path: '^1.3.9'
source_span: '^1.2.3'
yaml: '^2.1.12'
-dev_dependencies:
+ # TODO(ahe): Move analyzer dependency to dev_dependencies when
+ # https://github.com/dart-lang/dartdoc/issues/1775 is fixed.
analyzer: '^0.33.0'
+dev_dependencies:
args: '>=0.13.0 <2.0.0'
build_integration:
path: ../build_integration