diff --git a/pkg/front_end/testcases/general/export_test.dart b/pkg/front_end/testcases/general/export_test.dart index 13646cf00fe..a95dbfa242d 100644 --- a/pkg/front_end/testcases/general/export_test.dart +++ b/pkg/front_end/testcases/general/export_test.dart @@ -4,9 +4,10 @@ /// Test that exports are serialized in platform.dill. -// This is somewhat brittle and we should extend this test framework to be -// able to deal with multiple .dill files. -import 'dart:developer' show UserTag; +// Note: "dart:profiler" exports UserTag from "dart:developer". This is +// somewhat brittle and we should extend this test framework to be able to deal +// with multiple .dill files. +import 'dart:profiler' show UserTag; export 'dart:core' show print; diff --git a/pkg/front_end/testcases/general/export_test.dart.outline.expect b/pkg/front_end/testcases/general/export_test.dart.outline.expect index a49370d9103..e337eae4c9e 100644 --- a/pkg/front_end/testcases/general/export_test.dart.outline.expect +++ b/pkg/front_end/testcases/general/export_test.dart.outline.expect @@ -4,7 +4,7 @@ import "dart:core" as core; additionalExports = (core::print) -import "dart:developer"; +import "dart:profiler"; export "dart:core"; static method main() → dynamic diff --git a/pkg/front_end/testcases/general/export_test.dart.strong.expect b/pkg/front_end/testcases/general/export_test.dart.strong.expect index 3f5a30326a5..96ce0dd8632 100644 --- a/pkg/front_end/testcases/general/export_test.dart.strong.expect +++ b/pkg/front_end/testcases/general/export_test.dart.strong.expect @@ -5,7 +5,7 @@ import "dart:developer" as dev; additionalExports = (core::print) -import "dart:developer"; +import "dart:profiler"; export "dart:core"; static method main() → dynamic { diff --git a/pkg/front_end/testcases/general/export_test.dart.strong.transformed.expect b/pkg/front_end/testcases/general/export_test.dart.strong.transformed.expect index 3f5a30326a5..96ce0dd8632 100644 --- a/pkg/front_end/testcases/general/export_test.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/export_test.dart.strong.transformed.expect @@ -5,7 +5,7 @@ import "dart:developer" as dev; additionalExports = (core::print) -import "dart:developer"; +import "dart:profiler"; export "dart:core"; static method main() → dynamic { diff --git a/pkg/vm/lib/target/dart_runner.dart b/pkg/vm/lib/target/dart_runner.dart index 4749b08bffa..03722a78f4f 100644 --- a/pkg/vm/lib/target/dart_runner.dart +++ b/pkg/vm/lib/target/dart_runner.dart @@ -32,6 +32,7 @@ class DartRunnerTarget extends VmTarget { // PRODUCT mode. 'dart:mirrors', + 'dart:profiler', 'dart:typed_data', 'dart:nativewrappers', 'dart:io', diff --git a/pkg/vm/lib/target/flutter.dart b/pkg/vm/lib/target/flutter.dart index a5e312056d5..1182202129b 100644 --- a/pkg/vm/lib/target/flutter.dart +++ b/pkg/vm/lib/target/flutter.dart @@ -37,6 +37,7 @@ class FlutterTarget extends VmTarget { // PRODUCT mode. 'dart:mirrors', + 'dart:profiler', 'dart:typed_data', 'dart:nativewrappers', 'dart:io', diff --git a/pkg/vm/lib/target/flutter_runner.dart b/pkg/vm/lib/target/flutter_runner.dart index eb2a90e48ce..17511b8ad89 100644 --- a/pkg/vm/lib/target/flutter_runner.dart +++ b/pkg/vm/lib/target/flutter_runner.dart @@ -32,6 +32,7 @@ class FlutterRunnerTarget extends VmTarget { // PRODUCT mode. 'dart:mirrors', + 'dart:profiler', 'dart:typed_data', 'dart:nativewrappers', 'dart:io', diff --git a/pkg/vm/lib/target/vm.dart b/pkg/vm/lib/target/vm.dart index 0350a86cdbc..9c84d582457 100644 --- a/pkg/vm/lib/target/vm.dart +++ b/pkg/vm/lib/target/vm.dart @@ -69,6 +69,7 @@ class VmTarget extends Target { // PRODUCT mode. 'dart:mirrors', + 'dart:profiler', 'dart:typed_data', 'dart:vmservice_io', 'dart:_vmservice', diff --git a/runtime/observatory/tests/service/write_cpu_profile_timeline_rpc_test.dart b/runtime/observatory/tests/service/write_cpu_profile_timeline_rpc_test.dart index b94782ad77a..fad0eda245b 100644 --- a/runtime/observatory/tests/service/write_cpu_profile_timeline_rpc_test.dart +++ b/runtime/observatory/tests/service/write_cpu_profile_timeline_rpc_test.dart @@ -52,7 +52,7 @@ var tests = [ expect(event['pid'], isInt); expect(event['tid'], isInt); expect(event['ts'], isInt); - expect(event['cat'], equals("Developer")); + expect(event['cat'], equals("Profiler")); expect(event['args']['backtrace'], isString); } }, @@ -62,7 +62,7 @@ var vmArgs = [ '--profiler=true', '--profile-vm=false', // So this also works with DBC and KBC. '--timeline_recorder=ring', - '--timeline_streams=Developer' + '--timeline_streams=Profiler' ]; main(args) async => diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn index 0ab34511ef3..a526aec442e 100644 --- a/runtime/vm/BUILD.gn +++ b/runtime/vm/BUILD.gn @@ -13,6 +13,7 @@ import("../../sdk/lib/internal/internal_sources.gni") import("../../sdk/lib/isolate/isolate_sources.gni") import("../../sdk/lib/math/math_sources.gni") import("../../sdk/lib/mirrors/mirrors_sources.gni") +import("../../sdk/lib/profiler/profiler_sources.gni") import("../../sdk/lib/typed_data/typed_data_sources.gni") import("../../sdk/lib/vmservice/vmservice_sources.gni") import("../../sdk/lib/wasm/wasm_sources.gni") diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc index f8030dc9119..f73333161d4 100644 --- a/runtime/vm/bootstrap_natives.cc +++ b/runtime/vm/bootstrap_natives.cc @@ -127,6 +127,11 @@ void Bootstrap::SetupNativeResolver() { library.set_native_entry_symbol_resolver(symbol_resolver); #endif + library = Library::ProfilerLibrary(); + ASSERT(!library.IsNull()); + library.set_native_entry_resolver(resolver); + library.set_native_entry_symbol_resolver(symbol_resolver); + library = Library::TypedDataLibrary(); ASSERT(!library.IsNull()); library.set_native_entry_resolver(resolver); diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc index f023afdec76..bf716b7e8d3 100644 --- a/runtime/vm/dart_api_impl_test.cc +++ b/runtime/vm/dart_api_impl_test.cc @@ -7912,7 +7912,7 @@ TEST_CASE(DartAPI_NotifyLowMemory) { TEST_CASE(DartAPI_InvokeImportedFunction) { const char* kScriptChars = "import 'dart:math';\n" - "import 'dart:developer';\n" + "import 'dart:profiler';\n" "main() {}"; Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); EXPECT_VALID(lib); @@ -7924,6 +7924,11 @@ TEST_CASE(DartAPI_InvokeImportedFunction) { EXPECT_ERROR(result, "NoSuchMethodError: No top-level method 'max' declared."); + // The function 'getCurrentTag' is actually defined in the library + // dart:developer. However, the library dart:profiler exports dart:developer + // and exposes the function 'getCurrentTag'. + // NOTE: dart:profiler is deprecated. So, its use in this test is only + // an interim solution until we fix DartAPI_Invoke_CrossLibrary. Dart_Handle getCurrentTag = Dart_NewStringFromCString("getCurrentTag"); result = Dart_Invoke(lib, getCurrentTag, 0, NULL); EXPECT_ERROR( diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h index 1d2d57cb60f..9c9cda56f66 100644 --- a/runtime/vm/object_store.h +++ b/runtime/vm/object_store.h @@ -27,6 +27,7 @@ class ObjectPointerVisitor; M(Isolate, isolate) \ M(Math, math) \ M(Mirrors, mirrors) \ + M(Profiler, profiler) \ M(TypedData, typed_data) \ M(VMService, _vmservice) \ M(Wasm, wasm) diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc index 72c67925ead..d3a1450f5be 100644 --- a/runtime/vm/profiler_service.cc +++ b/runtime/vm/profiler_service.cc @@ -2545,7 +2545,7 @@ void Profile::PrintBacktrace(ProfileTrieNode* node, TextBuffer* buf) { } void Profile::AddToTimeline(bool code_trie) { - TimelineStream* stream = Timeline::GetDeveloperStream(); + TimelineStream* stream = Timeline::GetProfilerStream(); if (stream == NULL) { return; } diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h index 1bce4cc2dc8..65820164819 100644 --- a/runtime/vm/timeline.h +++ b/runtime/vm/timeline.h @@ -53,7 +53,7 @@ class Zone; V(Embedder, "dart:embedder") \ V(GC, "dart:gc") \ V(Isolate, "dart:isolate") \ - V(Developer, "dart:developer") \ + V(Profiler, "dart:profiler") \ V(VM, "dart:vm") // A stream of timeline events. A stream has a name and can be enabled or diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 135c6bd680d..818906b98b5 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -222,6 +222,7 @@ _full_sdk_libraries = [ "js_util", "math", "mirrors", + "profiler", "svg", "typed_data", "wasm", @@ -248,6 +249,7 @@ _full_sdk_libraries = [ # "isolate", # "math", # "mirrors", +# "profiler", # "typed_data", # ] _platform_sdk_libraries = _full_sdk_libraries diff --git a/sdk/lib/profiler/profiler.dart b/sdk/lib/profiler/profiler.dart new file mode 100644 index 00000000000..1b96dfe2266 --- /dev/null +++ b/sdk/lib/profiler/profiler.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2014, 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. + +/// Please see 'dart:developer'. +@Deprecated("Dart SDK 1.12") +library dart.profiler; + +export 'dart:developer' + show getCurrentTag, Counter, Gauge, Metric, Metrics, UserTag; diff --git a/sdk/lib/profiler/profiler_sources.gni b/sdk/lib/profiler/profiler_sources.gni new file mode 100644 index 00000000000..adbf4474b12 --- /dev/null +++ b/sdk/lib/profiler/profiler_sources.gni @@ -0,0 +1,8 @@ +# Copyright (c) 2017, 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. + +profiler_sdk_sources = [ + "profiler.dart", + # The above file needs to be first if additional parts are added to the lib. +]