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

Unified Diff: runtime/vm/profiler_test.cc

Issue 2989093002: [vm] Don't enable the profiler by default. Enable the profiler at startup with --observe, or later … (Closed)
Patch Set: . Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/profiler_test.cc
diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
index c431944674fd809961d0a55100ba1c41ebf4f5c8..095766c48e195f581d8ffd2485e10c56cf4b59a1 100644
--- a/runtime/vm/profiler_test.cc
+++ b/runtime/vm/profiler_test.cc
@@ -190,6 +190,7 @@ class AllocationFilter : public SampleFilter {
};
TEST_CASE(Profiler_TrivialRecordAllocation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript =
"class A {\n"
@@ -314,6 +315,8 @@ DART_NOINLINE static void NativeAllocationSampleHelper(char** result) {
}
ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {
+ Profiler::EnsureEnabled();
+
bool enable_malloc_hooks_saved = FLAG_profiler_native_memory;
FLAG_profiler_native_memory = true;
@@ -516,6 +519,8 @@ ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) {
// !defined(TARGET_ARCH_DBC) && !defined(HOST_OS_FUCHSIA)
TEST_CASE(Profiler_ToggleRecordAllocation) {
+ Profiler::EnsureEnabled();
+
DisableNativeProfileScope dnps;
const char* kScript =
"class A {\n"
@@ -645,6 +650,7 @@ TEST_CASE(Profiler_ToggleRecordAllocation) {
}
TEST_CASE(Profiler_CodeTicks) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript =
"class A {\n"
@@ -747,6 +753,7 @@ TEST_CASE(Profiler_CodeTicks) {
}
TEST_CASE(Profiler_FunctionTicks) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript =
"class A {\n"
@@ -849,6 +856,7 @@ TEST_CASE(Profiler_FunctionTicks) {
}
TEST_CASE(Profiler_IntrinsicAllocation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript = "double foo(double a, double b) => a + b;";
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
@@ -920,6 +928,7 @@ TEST_CASE(Profiler_IntrinsicAllocation) {
}
TEST_CASE(Profiler_ArrayAllocation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript =
"List foo() => new List(4);\n"
@@ -1016,6 +1025,7 @@ TEST_CASE(Profiler_ArrayAllocation) {
}
TEST_CASE(Profiler_ContextAllocation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript =
"var msg1 = 'a';\n"
@@ -1085,6 +1095,7 @@ TEST_CASE(Profiler_ContextAllocation) {
}
TEST_CASE(Profiler_ClosureAllocation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript =
"var msg1 = 'a';\n"
@@ -1156,6 +1167,7 @@ TEST_CASE(Profiler_ClosureAllocation) {
}
TEST_CASE(Profiler_TypedArrayAllocation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript =
"import 'dart:typed_data';\n"
@@ -1240,6 +1252,7 @@ TEST_CASE(Profiler_TypedArrayAllocation) {
}
TEST_CASE(Profiler_StringAllocation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
const char* kScript = "String foo(String a, String b) => a + b;";
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
@@ -1325,6 +1338,7 @@ TEST_CASE(Profiler_StringAllocation) {
}
TEST_CASE(Profiler_StringInterpolation) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
const char* kScript = "String foo(String a, String b) => '$a | $b';";
@@ -1413,6 +1427,7 @@ TEST_CASE(Profiler_StringInterpolation) {
}
TEST_CASE(Profiler_FunctionInline) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
@@ -1702,6 +1717,7 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
// This test checks the profiler service takes this into account; see
// ProfileBuilder::ProcessFrame.
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
const char* kScript =
@@ -1833,6 +1849,7 @@ TEST_CASE(Profiler_InliningIntervalBoundry) {
}
TEST_CASE(Profiler_ChainedSamples) {
+ Profiler::EnsureEnabled();
MaxProfileDepthScope mpds(32);
DisableNativeProfileScope dnps;
@@ -1945,6 +1962,7 @@ TEST_CASE(Profiler_ChainedSamples) {
}
TEST_CASE(Profiler_BasicSourcePosition) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
const char* kScript =
@@ -2019,6 +2037,7 @@ TEST_CASE(Profiler_BasicSourcePosition) {
}
TEST_CASE(Profiler_BasicSourcePositionOptimized) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
// We use the AlwaysInline and NeverInline annotations in this test.
@@ -2112,6 +2131,7 @@ TEST_CASE(Profiler_BasicSourcePositionOptimized) {
}
TEST_CASE(Profiler_SourcePosition) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
const char* kScript =
@@ -2216,6 +2236,7 @@ TEST_CASE(Profiler_SourcePosition) {
}
TEST_CASE(Profiler_SourcePositionOptimized) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
// We use the AlwaysInline and NeverInline annotations in this test.
@@ -2340,6 +2361,7 @@ TEST_CASE(Profiler_SourcePositionOptimized) {
}
TEST_CASE(Profiler_BinaryOperatorSourcePosition) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
const char* kScript =
@@ -2453,6 +2475,7 @@ TEST_CASE(Profiler_BinaryOperatorSourcePosition) {
}
TEST_CASE(Profiler_BinaryOperatorSourcePositionOptimized) {
+ Profiler::EnsureEnabled();
DisableNativeProfileScope dnps;
DisableBackgroundCompilationScope dbcs;
// We use the AlwaysInline and NeverInline annotations in this test.
@@ -2625,6 +2648,7 @@ static uword FindPCForTokenPosition(const Code& code, TokenPosition tp) {
}
TEST_CASE(Profiler_GetSourceReport) {
+ Profiler::EnsureEnabled();
const char* kScript =
"doWork(i) => i * i;\n"
"main() {\n"

Powered by Google App Engine
This is Rietveld 408576698