| Index: runtime/vm/profiler_test.cc
|
| diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
|
| index c431944674fd809961d0a55100ba1c41ebf4f5c8..56c9e0310ca16e604d161b481915aaa50c8c17a1 100644
|
| --- a/runtime/vm/profiler_test.cc
|
| +++ b/runtime/vm/profiler_test.cc
|
| @@ -189,7 +189,15 @@ class AllocationFilter : public SampleFilter {
|
| bool enable_vm_ticks_;
|
| };
|
|
|
| +static void EnableProfiler() {
|
| + if (!FLAG_profiler) {
|
| + FLAG_profiler = true;
|
| + Profiler::InitOnce();
|
| + }
|
| +}
|
| +
|
| TEST_CASE(Profiler_TrivialRecordAllocation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "class A {\n"
|
| @@ -314,6 +322,8 @@ DART_NOINLINE static void NativeAllocationSampleHelper(char** result) {
|
| }
|
|
|
| ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {
|
| + EnableProfiler();
|
| +
|
| bool enable_malloc_hooks_saved = FLAG_profiler_native_memory;
|
| FLAG_profiler_native_memory = true;
|
|
|
| @@ -516,6 +526,8 @@ ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {
|
| // !defined(TARGET_ARCH_DBC) && !defined(HOST_OS_FUCHSIA)
|
|
|
| TEST_CASE(Profiler_ToggleRecordAllocation) {
|
| + EnableProfiler();
|
| +
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "class A {\n"
|
| @@ -645,6 +657,7 @@ TEST_CASE(Profiler_ToggleRecordAllocation) {
|
| }
|
|
|
| TEST_CASE(Profiler_CodeTicks) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "class A {\n"
|
| @@ -747,6 +760,7 @@ TEST_CASE(Profiler_CodeTicks) {
|
| }
|
|
|
| TEST_CASE(Profiler_FunctionTicks) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "class A {\n"
|
| @@ -849,6 +863,7 @@ TEST_CASE(Profiler_FunctionTicks) {
|
| }
|
|
|
| TEST_CASE(Profiler_IntrinsicAllocation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript = "double foo(double a, double b) => a + b;";
|
| Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
|
| @@ -920,6 +935,7 @@ TEST_CASE(Profiler_IntrinsicAllocation) {
|
| }
|
|
|
| TEST_CASE(Profiler_ArrayAllocation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "List foo() => new List(4);\n"
|
| @@ -1016,6 +1032,7 @@ TEST_CASE(Profiler_ArrayAllocation) {
|
| }
|
|
|
| TEST_CASE(Profiler_ContextAllocation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "var msg1 = 'a';\n"
|
| @@ -1085,6 +1102,7 @@ TEST_CASE(Profiler_ContextAllocation) {
|
| }
|
|
|
| TEST_CASE(Profiler_ClosureAllocation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "var msg1 = 'a';\n"
|
| @@ -1156,6 +1174,7 @@ TEST_CASE(Profiler_ClosureAllocation) {
|
| }
|
|
|
| TEST_CASE(Profiler_TypedArrayAllocation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript =
|
| "import 'dart:typed_data';\n"
|
| @@ -1240,6 +1259,7 @@ TEST_CASE(Profiler_TypedArrayAllocation) {
|
| }
|
|
|
| TEST_CASE(Profiler_StringAllocation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| const char* kScript = "String foo(String a, String b) => a + b;";
|
| Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
|
| @@ -1325,6 +1345,7 @@ TEST_CASE(Profiler_StringAllocation) {
|
| }
|
|
|
| TEST_CASE(Profiler_StringInterpolation) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| const char* kScript = "String foo(String a, String b) => '$a | $b';";
|
| @@ -1413,6 +1434,7 @@ TEST_CASE(Profiler_StringInterpolation) {
|
| }
|
|
|
| TEST_CASE(Profiler_FunctionInline) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
|
|
| @@ -1702,6 +1724,7 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
|
| // This test checks the profiler service takes this into account; see
|
| // ProfileBuilder::ProcessFrame.
|
|
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| const char* kScript =
|
| @@ -1833,6 +1856,7 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
|
| }
|
|
|
| TEST_CASE(Profiler_ChainedSamples) {
|
| + EnableProfiler();
|
| MaxProfileDepthScope mpds(32);
|
| DisableNativeProfileScope dnps;
|
|
|
| @@ -1945,6 +1969,7 @@ TEST_CASE(Profiler_ChainedSamples) {
|
| }
|
|
|
| TEST_CASE(Profiler_BasicSourcePosition) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| const char* kScript =
|
| @@ -2019,6 +2044,7 @@ TEST_CASE(Profiler_BasicSourcePosition) {
|
| }
|
|
|
| TEST_CASE(Profiler_BasicSourcePositionOptimized) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| // We use the AlwaysInline and NeverInline annotations in this test.
|
| @@ -2112,6 +2138,7 @@ TEST_CASE(Profiler_BasicSourcePositionOptimized) {
|
| }
|
|
|
| TEST_CASE(Profiler_SourcePosition) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| const char* kScript =
|
| @@ -2216,6 +2243,7 @@ TEST_CASE(Profiler_SourcePosition) {
|
| }
|
|
|
| TEST_CASE(Profiler_SourcePositionOptimized) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| // We use the AlwaysInline and NeverInline annotations in this test.
|
| @@ -2340,6 +2368,7 @@ TEST_CASE(Profiler_SourcePositionOptimized) {
|
| }
|
|
|
| TEST_CASE(Profiler_BinaryOperatorSourcePosition) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| const char* kScript =
|
| @@ -2453,6 +2482,7 @@ TEST_CASE(Profiler_BinaryOperatorSourcePosition) {
|
| }
|
|
|
| TEST_CASE(Profiler_BinaryOperatorSourcePositionOptimized) {
|
| + EnableProfiler();
|
| DisableNativeProfileScope dnps;
|
| DisableBackgroundCompilationScope dbcs;
|
| // We use the AlwaysInline and NeverInline annotations in this test.
|
| @@ -2625,6 +2655,7 @@ static uword FindPCForTokenPosition(const Code& code, TokenPosition tp) {
|
| }
|
|
|
| TEST_CASE(Profiler_GetSourceReport) {
|
| + EnableProfiler();
|
| const char* kScript =
|
| "doWork(i) => i * i;\n"
|
| "main() {\n"
|
|
|