[heap profiler] Switch from OOPHP to in-process HP by default.
Drive-by: rework the flag descriptions.
BUG=923459
[email protected]
Change-Id: I2b95c7e34609f84d8efec5e191812ab74580cddd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1544163
Commit-Queue: Alexei Filippov <[email protected]>
Reviewed-by: Erik Chen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#645655}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java
index d5c59aa..1b926dca 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java
@@ -49,6 +49,7 @@
@Test
@MediumTest
+ @CommandLineFlags.Add({"memlog-in-process=off"})
public void testModeBrowserDynamic() throws Exception {
HeapProfilingTestShim shim = new HeapProfilingTestShim();
Assert.assertTrue(shim.runTestForMode("browser", true, "native", true, false, false));
@@ -63,6 +64,7 @@
@Test
@MediumTest
+ @CommandLineFlags.Add({"memlog-in-process=off"})
public void testModeBrowserDynamicPseudo() throws Exception {
HeapProfilingTestShim shim = new HeapProfilingTestShim();
Assert.assertTrue(shim.runTestForMode("browser", true, "pseudo", true, false, false));
@@ -101,6 +103,7 @@
@Test
@MediumTest
+ @CommandLineFlags.Add({"memlog-in-process=off"})
public void testModeBrowserDynamicPseudoSampleEverything() throws Exception {
HeapProfilingTestShim shim = new HeapProfilingTestShim();
Assert.assertTrue(shim.runTestForMode("browser", true, "pseudo", true, true, true));
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 546a724..5918c2e 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -725,35 +725,66 @@
nullptr}};
#endif // OS_ANDROID
-const FeatureEntry::Choice kEnableOutOfProcessHeapProfilingChoices[] = {
+const FeatureEntry::Choice kMemlogModeChoices[] = {
{flags_ui::kGenericExperimentChoiceDisabled, "", ""},
- {flag_descriptions::kEnableOutOfProcessHeapProfilingModeMinimal,
- heap_profiling::kMemlog, heap_profiling::kMemlogModeMinimal},
- {flag_descriptions::kEnableOutOfProcessHeapProfilingModeAll,
- heap_profiling::kMemlog, heap_profiling::kMemlogModeAll},
- {flag_descriptions::kEnableOutOfProcessHeapProfilingModeBrowser,
- heap_profiling::kMemlog, heap_profiling::kMemlogModeBrowser},
- {flag_descriptions::kEnableOutOfProcessHeapProfilingModeGpu,
- heap_profiling::kMemlog, heap_profiling::kMemlogModeGpu},
- {flag_descriptions::kEnableOutOfProcessHeapProfilingModeAllRenderers,
- heap_profiling::kMemlog, heap_profiling::kMemlogModeAllRenderers},
- {flag_descriptions::kEnableOutOfProcessHeapProfilingModeManual,
- heap_profiling::kMemlog, heap_profiling::kMemlogModeManual},
+ {flag_descriptions::kMemlogModeMinimal, heap_profiling::kMemlogMode,
+ heap_profiling::kMemlogModeMinimal},
+ {flag_descriptions::kMemlogModeAll, heap_profiling::kMemlogMode,
+ heap_profiling::kMemlogModeAll},
+ {flag_descriptions::kMemlogModeBrowser, heap_profiling::kMemlogMode,
+ heap_profiling::kMemlogModeBrowser},
+ {flag_descriptions::kMemlogModeGpu, heap_profiling::kMemlogMode,
+ heap_profiling::kMemlogModeGpu},
+ {flag_descriptions::kMemlogModeAllRenderers, heap_profiling::kMemlogMode,
+ heap_profiling::kMemlogModeAllRenderers},
+ {flag_descriptions::kMemlogModeRendererSampling,
+ heap_profiling::kMemlogMode, heap_profiling::kMemlogModeRendererSampling},
};
-const FeatureEntry::Choice kOOPHPStackModeChoices[] = {
- {flags_ui::kGenericExperimentChoiceDisabled, "", ""},
- {flag_descriptions::kOOPHPStackModeNative, heap_profiling::kMemlogStackMode,
- heap_profiling::kMemlogStackModeNative},
- {flag_descriptions::kOOPHPStackModeNativeWithThreadNames,
+const FeatureEntry::Choice kMemlogStackModeChoices[] = {
+ {flags_ui::kGenericExperimentChoiceDefault, "", ""},
+ {flag_descriptions::kMemlogStackModeNative,
+ heap_profiling::kMemlogStackMode, heap_profiling::kMemlogStackModeNative},
+ {flag_descriptions::kMemlogStackModeNativeWithThreadNames,
heap_profiling::kMemlogStackMode,
heap_profiling::kMemlogStackModeNativeWithThreadNames},
- {flag_descriptions::kOOPHPStackModePseudo, heap_profiling::kMemlogStackMode,
- heap_profiling::kMemlogStackModePseudo},
- {flag_descriptions::kOOPHPStackModeMixed, heap_profiling::kMemlogStackMode,
+ {flag_descriptions::kMemlogStackModePseudo,
+ heap_profiling::kMemlogStackMode, heap_profiling::kMemlogStackModePseudo},
+ {flag_descriptions::kMemlogStackModeMixed, heap_profiling::kMemlogStackMode,
heap_profiling::kMemlogStackModeMixed},
};
+const FeatureEntry::Choice kMemlogInProcessChoices[] = {
+ {flags_ui::kGenericExperimentChoiceDefault, "", ""},
+ {flag_descriptions::kMemlogInProcessDisabled,
+ heap_profiling::kMemlogInProcess,
+ heap_profiling::kMemlogInProcessDisabled},
+ {flag_descriptions::kMemlogInProcessEnabled,
+ heap_profiling::kMemlogInProcess, heap_profiling::kMemlogInProcessEnabled},
+};
+
+const FeatureEntry::Choice kMemlogSamplingRateChoices[] = {
+ {flags_ui::kGenericExperimentChoiceDefault, "", ""},
+ {flag_descriptions::kMemlogSamplingRate10KB,
+ heap_profiling::kMemlogSamplingRate,
+ heap_profiling::kMemlogSamplingRate10KB},
+ {flag_descriptions::kMemlogSamplingRate50KB,
+ heap_profiling::kMemlogSamplingRate,
+ heap_profiling::kMemlogSamplingRate50KB},
+ {flag_descriptions::kMemlogSamplingRate100KB,
+ heap_profiling::kMemlogSamplingRate,
+ heap_profiling::kMemlogSamplingRate100KB},
+ {flag_descriptions::kMemlogSamplingRate500KB,
+ heap_profiling::kMemlogSamplingRate,
+ heap_profiling::kMemlogSamplingRate500KB},
+ {flag_descriptions::kMemlogSamplingRate1MB,
+ heap_profiling::kMemlogSamplingRate,
+ heap_profiling::kMemlogSamplingRate1MB},
+ {flag_descriptions::kMemlogSamplingRate5MB,
+ heap_profiling::kMemlogSamplingRate,
+ heap_profiling::kMemlogSamplingRate5MB},
+};
+
const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = {
{OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}};
const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = {
@@ -2633,23 +2664,21 @@
flag_descriptions::kSamplingHeapProfilerDescription, kOsAll,
SINGLE_VALUE_TYPE(switches::kSamplingHeapProfiler)},
- {"memlog", flag_descriptions::kEnableOutOfProcessHeapProfilingName,
- flag_descriptions::kEnableOutOfProcessHeapProfilingDescription, kOsAll,
- MULTI_VALUE_TYPE(kEnableOutOfProcessHeapProfilingChoices)},
+ {"memlog", flag_descriptions::kMemlogName,
+ flag_descriptions::kMemlogDescription, kOsAll,
+ MULTI_VALUE_TYPE(kMemlogModeChoices)},
- {"memlog-in-process",
- flag_descriptions::kOutOfProcessHeapProfilingInProcess,
- flag_descriptions::kOutOfProcessHeapProfilingInProcessDescription, kOsAll,
- SINGLE_VALUE_TYPE(heap_profiling::kMemlogInProcess)},
+ {"memlog-in-process", flag_descriptions::kMemlogInProcessName,
+ flag_descriptions::kMemlogInProcessDescription, kOsAll,
+ MULTI_VALUE_TYPE(kMemlogInProcessChoices)},
- {"memlog-sampling-rate",
- flag_descriptions::kOutOfProcessHeapProfilingSamplingRate,
- flag_descriptions::kOutOfProcessHeapProfilingSamplingRateDescription,
- kOsAll, SINGLE_VALUE_TYPE(heap_profiling::kMemlogSamplingRate)},
+ {"memlog-sampling-rate", flag_descriptions::kMemlogSamplingRateName,
+ flag_descriptions::kMemlogSamplingRateDescription, kOsAll,
+ MULTI_VALUE_TYPE(kMemlogSamplingRateChoices)},
- {"memlog-stack-mode", flag_descriptions::kOOPHPStackModeName,
- flag_descriptions::kOOPHPStackModeDescription, kOsAll,
- MULTI_VALUE_TYPE(kOOPHPStackModeChoices)},
+ {"memlog-stack-mode", flag_descriptions::kMemlogStackModeName,
+ flag_descriptions::kMemlogStackModeDescription, kOsAll,
+ MULTI_VALUE_TYPE(kMemlogStackModeChoices)},
{"omnibox-ui-hide-steady-state-url-scheme",
flag_descriptions::kOmniboxUIHideSteadyStateUrlSchemeName,
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index f4de97ca..904bdb9 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -780,63 +780,64 @@
"If enabled, event targeting uses the new viz-assisted hit-testing logic, "
"with hit-test data computed from the CompositorFrame.";
-const char kEnableOutOfProcessHeapProfilingName[] =
- "Chrome heap profiling start mode.";
-const char kEnableOutOfProcessHeapProfilingDescription[] =
- "Starts heap profiling service that records sampled memory allocation "
- "profile having each sample attributed with a callstack. "
- "The sampling resolution is controlled with --memlog-sampling flag. "
- "Recorded heap dumps can be obtained at chrome://tracing "
- "[category:memory-infra] and chrome://memory-internals. This setting "
- "controls which processes are profiled. As long as this setting is not "
- "disabled, users can start profiling any given process in "
- "chrome://memory-internals.";
-const char kEnableOutOfProcessHeapProfilingModeMinimal[] = "Browser and GPU";
-const char kEnableOutOfProcessHeapProfilingModeAll[] = "All processes";
-const char kEnableOutOfProcessHeapProfilingModeAllRenderers[] = "All renderers";
-const char kEnableOutOfProcessHeapProfilingModeBrowser[] = "Only browser";
-const char kEnableOutOfProcessHeapProfilingModeGpu[] = "Only GPU.";
-const char kEnableOutOfProcessHeapProfilingModeManual[] =
- "None by default. Visit chrome://memory-internals to choose which "
- "processes to profile.";
-const char kEnableOutOfProcessHeapProfilingModeRendererSampling[] =
- "Profile a random sampling of renderer processes, ensuring only one is "
- "ever profiled at a time.";
-
const char kCompositorThreadedScrollbarScrollingName[] =
"Enable compositor threaded scrollbar scrolling";
const char kCompositorThreadedScrollbarScrollingDescription[] =
"Enables pointer-based scrollbar scrolling on the compositor thread "
"instead of the main thread";
-const char kOutOfProcessHeapProfilingInProcess[] =
- "Run the heap profiling service in the browser process.";
-const char kOutOfProcessHeapProfilingInProcessDescription[] =
- "Makes profiling service (if enabled) to be executed within the browser "
- "process. By default the service is run in a dedicated utility process.";
+const char kMemlogName[] = "Chrome heap profiler start mode.";
+const char kMemlogDescription[] =
+ "Starts heap profiling service that records sampled memory allocation "
+ "profile having each sample attributed with a callstack. "
+ "The sampling resolution is controlled with --memlog-sampling-rate flag. "
+ "Recorded heap dumps can be obtained at chrome://tracing "
+ "[category:memory-infra] and chrome://memory-internals. This setting "
+ "controls which processes will be profiled since their start. To profile "
+ "any given process at a later time use chrome://memory-internals page.";
+const char kMemlogModeMinimal[] = "Browser and GPU";
+const char kMemlogModeAll[] = "All processes";
+const char kMemlogModeAllRenderers[] = "All renderers";
+const char kMemlogModeRendererSampling[] = "Single renderer";
+const char kMemlogModeBrowser[] = "Browser only";
+const char kMemlogModeGpu[] = "GPU only";
-const char kOutOfProcessHeapProfilingSamplingRate[] =
- "Sampling interval in bytes for memlog allocations.";
-const char kOutOfProcessHeapProfilingSamplingRateDescription[] =
- "Use a poisson process to sample allocations. Defaults to a sampling rate "
- "of 100KB. This results in low noise for large and/or frequent allocations "
+const char kMemlogInProcessName[] = "Heap profiling service process type.";
+const char kMemlogInProcessDescription[] =
+ "Controls if the heap profiling service runs within the browser process "
+ "(default) or in a dedicated utility process.";
+const char kMemlogInProcessEnabled[] = "In browser process";
+const char kMemlogInProcessDisabled[] = "As separate process";
+
+const char kMemlogSamplingRateName[] =
+ "Heap profiling sampling interval (in bytes).";
+const char kMemlogSamplingRateDescription[] =
+ "Heap profiling service uses Poisson process to sample allocations. "
+ "Default value for the interval between samples is 100000 (100KB). "
+ "This results in low noise for large and/or frequent allocations "
"[size * frequency >> 100KB]. This means that aggregate numbers [e.g. "
"total size of malloc-ed objects] and large and/or frequent allocations "
- "can be trusted with high fidelity.";
+ "can be trusted with high fidelity. "
+ "Lower intervals produce higher samples resolution, but come at a cost of "
+ "higher performance overhead.";
+const char kMemlogSamplingRate10KB[] = "10KB";
+const char kMemlogSamplingRate50KB[] = "50KB";
+const char kMemlogSamplingRate100KB[] = "100KB";
+const char kMemlogSamplingRate500KB[] = "500KB";
+const char kMemlogSamplingRate1MB[] = "1MB";
+const char kMemlogSamplingRate5MB[] = "5MB";
-const char kOOPHPStackModeName[] =
- "The type of stack to record for memlog heap dumps";
-const char kOOPHPStackModeDescription[] =
- "By default, memlog heap dumps record native stacks, which requires a "
- "post-processing step to symbolize. Requires a custom build with frame "
- "pointers to work on Android. Native with thread names will add the thread "
- "name as the first frame of each native stack. It's also possible to "
- "record a pseudo stack using trace events as identifiers. It's also "
- "possible to do a mix of both.";
-const char kOOPHPStackModeMixed[] = "Mixed";
-const char kOOPHPStackModeNative[] = "Native";
-const char kOOPHPStackModeNativeWithThreadNames[] = "Native with thread names";
-const char kOOPHPStackModePseudo[] = "Trace events";
+const char kMemlogStackModeName[] = "Heap profiling stack traces type.";
+const char kMemlogStackModeDescription[] =
+ "By default heap profiling service records native stacks. "
+ "A post-processing step is required to symbolize the stacks. "
+ "'Native with thread names' adds the thread name as the first frame of "
+ "each native stack. It's also possible to record a pseudo stack using "
+ "trace events as identifiers. It's also possible to do a mix of both.";
+const char kMemlogStackModeMixed[] = "Mixed";
+const char kMemlogStackModeNative[] = "Native";
+const char kMemlogStackModeNativeWithThreadNames[] = "Native with thread names";
+const char kMemlogStackModePseudo[] = "Trace events";
const char kEnablePixelCanvasRecordingName[] = "Enable pixel canvas recording";
const char kEnablePixelCanvasRecordingDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 6dd221b..097156e 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -469,26 +469,36 @@
extern const char kVizHitTestDrawQuadName[];
extern const char kVizHitTestDrawQuadDescription[];
-extern const char kEnableOutOfProcessHeapProfilingName[];
-extern const char kEnableOutOfProcessHeapProfilingDescription[];
-extern const char kEnableOutOfProcessHeapProfilingModeMinimal[];
-extern const char kEnableOutOfProcessHeapProfilingModeAll[];
-extern const char kEnableOutOfProcessHeapProfilingModeAllRenderers[];
-extern const char kEnableOutOfProcessHeapProfilingModeBrowser[];
-extern const char kEnableOutOfProcessHeapProfilingModeGpu[];
-extern const char kEnableOutOfProcessHeapProfilingModeManual[];
-extern const char kEnableOutOfProcessHeapProfilingModeRendererSampling[];
-extern const char kOutOfProcessHeapProfilingInProcess[];
-extern const char kOutOfProcessHeapProfilingInProcessDescription[];
-extern const char kOutOfProcessHeapProfilingSamplingRate[];
-extern const char kOutOfProcessHeapProfilingSamplingRateDescription[];
+extern const char kMemlogName[];
+extern const char kMemlogDescription[];
+extern const char kMemlogModeMinimal[];
+extern const char kMemlogModeAll[];
+extern const char kMemlogModeAllRenderers[];
+extern const char kMemlogModeBrowser[];
+extern const char kMemlogModeGpu[];
+extern const char kMemlogModeManual[];
+extern const char kMemlogModeRendererSampling[];
-extern const char kOOPHPStackModeName[];
-extern const char kOOPHPStackModeDescription[];
-extern const char kOOPHPStackModeMixed[];
-extern const char kOOPHPStackModeNative[];
-extern const char kOOPHPStackModeNativeWithThreadNames[];
-extern const char kOOPHPStackModePseudo[];
+extern const char kMemlogInProcessName[];
+extern const char kMemlogInProcessDescription[];
+extern const char kMemlogInProcessDisabled[];
+extern const char kMemlogInProcessEnabled[];
+
+extern const char kMemlogSamplingRateName[];
+extern const char kMemlogSamplingRateDescription[];
+extern const char kMemlogSamplingRate10KB[];
+extern const char kMemlogSamplingRate50KB[];
+extern const char kMemlogSamplingRate100KB[];
+extern const char kMemlogSamplingRate500KB[];
+extern const char kMemlogSamplingRate1MB[];
+extern const char kMemlogSamplingRate5MB[];
+
+extern const char kMemlogStackModeName[];
+extern const char kMemlogStackModeDescription[];
+extern const char kMemlogStackModeMixed[];
+extern const char kMemlogStackModeNative[];
+extern const char kMemlogStackModeNativeWithThreadNames[];
+extern const char kMemlogStackModePseudo[];
extern const char kEnableNewDownloadBackendName[];
extern const char kEnableNewDownloadBackendDescription[];
diff --git a/chrome/browser/profiling_host/memlog_browsertest.cc b/chrome/browser/profiling_host/memlog_browsertest.cc
index 67238e6..074f641 100644
--- a/chrome/browser/profiling_host/memlog_browsertest.cc
+++ b/chrome/browser/profiling_host/memlog_browsertest.cc
@@ -44,43 +44,46 @@
public testing::WithParamInterface<TestParam> {
void SetUpDefaultCommandLine(base::CommandLine* command_line) override {
InProcessBrowserTest::SetUpDefaultCommandLine(command_line);
- if (GetParam().start_profiling_with_command_line_flag) {
- if (GetParam().mode == Mode::kAllRenderers) {
- command_line->AppendSwitchASCII(
- heap_profiling::kMemlog, heap_profiling::kMemlogModeAllRenderers);
- } else if (GetParam().mode == Mode::kAll) {
- command_line->AppendSwitchASCII(heap_profiling::kMemlog,
- heap_profiling::kMemlogModeAll);
- } else {
- NOTREACHED();
- }
- if (!GetParam().stream_samples)
- command_line->AppendSwitch(heap_profiling::kMemlogInProcess);
+ if (GetParam().stream_samples) {
+ command_line->AppendSwitchASCII(heap_profiling::kMemlogInProcess,
+ heap_profiling::kMemlogInProcessDisabled);
+ }
- if (!GetParam().should_sample) {
- command_line->AppendSwitchASCII(heap_profiling::kMemlogSamplingRate,
- "1");
- }
+ if (!GetParam().start_profiling_with_command_line_flag)
+ return;
- if (GetParam().stack_mode == mojom::StackMode::PSEUDO) {
- command_line->AppendSwitchASCII(heap_profiling::kMemlogStackMode,
- heap_profiling::kMemlogStackModePseudo);
- } else if (GetParam().stack_mode ==
- mojom::StackMode::NATIVE_WITH_THREAD_NAMES) {
- command_line->AppendSwitchASCII(
- heap_profiling::kMemlogStackMode,
- heap_profiling::kMemlogStackModeNativeWithThreadNames);
- } else if (GetParam().stack_mode ==
- mojom::StackMode::NATIVE_WITHOUT_THREAD_NAMES) {
- command_line->AppendSwitchASCII(heap_profiling::kMemlogStackMode,
- heap_profiling::kMemlogStackModeNative);
- } else if (GetParam().stack_mode == mojom::StackMode::MIXED) {
- command_line->AppendSwitchASCII(heap_profiling::kMemlogStackMode,
- heap_profiling::kMemlogStackModeMixed);
- } else {
- NOTREACHED();
- }
+ if (GetParam().mode == Mode::kAllRenderers) {
+ command_line->AppendSwitchASCII(heap_profiling::kMemlogMode,
+ heap_profiling::kMemlogModeAllRenderers);
+ } else if (GetParam().mode == Mode::kAll) {
+ command_line->AppendSwitchASCII(heap_profiling::kMemlogMode,
+ heap_profiling::kMemlogModeAll);
+ } else {
+ NOTREACHED();
+ }
+
+ if (!GetParam().should_sample) {
+ command_line->AppendSwitchASCII(heap_profiling::kMemlogSamplingRate, "1");
+ }
+
+ if (GetParam().stack_mode == mojom::StackMode::PSEUDO) {
+ command_line->AppendSwitchASCII(heap_profiling::kMemlogStackMode,
+ heap_profiling::kMemlogStackModePseudo);
+ } else if (GetParam().stack_mode ==
+ mojom::StackMode::NATIVE_WITH_THREAD_NAMES) {
+ command_line->AppendSwitchASCII(
+ heap_profiling::kMemlogStackMode,
+ heap_profiling::kMemlogStackModeNativeWithThreadNames);
+ } else if (GetParam().stack_mode ==
+ mojom::StackMode::NATIVE_WITHOUT_THREAD_NAMES) {
+ command_line->AppendSwitchASCII(heap_profiling::kMemlogStackMode,
+ heap_profiling::kMemlogStackModeNative);
+ } else if (GetParam().stack_mode == mojom::StackMode::MIXED) {
+ command_line->AppendSwitchASCII(heap_profiling::kMemlogStackMode,
+ heap_profiling::kMemlogStackModeMixed);
+ } else {
+ NOTREACHED();
}
}
};