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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2876543002: memory-infra: Don't invoke all dump providers in SUMMARY_ONLY mode (Closed)
Patch Set: address comments Created 3 years, 7 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
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 32c93f7558e2900ebbaf0c87efe19c3b9e824a20..3df7503165773994c8d5e3162408856d69bc0ebe 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -320,10 +320,18 @@ void MemoryDumpManager::RegisterDumpProviderInternal(
if (dumper_registrations_ignored_for_testing_)
return;
+ // A handful of MDPs are required to compute the summary struct these are
+ // 'whitelisted for summary mode'. These MDPs are a subset of those which
+ // have small enough performance overhead that it is resonable to run them
+ // in the background while the user is doing other things. Those MDPs are
+ // 'whitelisted for background mode'.
bool whitelisted_for_background_mode = IsMemoryDumpProviderWhitelisted(name);
- scoped_refptr<MemoryDumpProviderInfo> mdpinfo =
- new MemoryDumpProviderInfo(mdp, name, std::move(task_runner), options,
- whitelisted_for_background_mode);
+ bool whitelisted_for_summary_mode =
+ IsMemoryDumpProviderWhitelistedForSummary(name);
+
+ scoped_refptr<MemoryDumpProviderInfo> mdpinfo = new MemoryDumpProviderInfo(
+ mdp, name, std::move(task_runner), options,
+ whitelisted_for_background_mode, whitelisted_for_summary_mode);
if (options.is_fast_polling_supported) {
DCHECK(!mdpinfo->task_runner) << "MemoryDumpProviders capable of fast "
@@ -563,6 +571,14 @@ void MemoryDumpManager::SetupNextMemoryDump(
return SetupNextMemoryDump(std::move(pmd_async_state));
}
+ // If we are in summary mode, we only need to invoke the providers
+ // whitelisted for summary mode.
+ if (pmd_async_state->req_args.dump_type == MemoryDumpType::SUMMARY_ONLY &&
+ !mdpinfo->whitelisted_for_summary_mode) {
+ pmd_async_state->pending_dump_providers.pop_back();
+ return SetupNextMemoryDump(std::move(pmd_async_state));
+ }
+
// If the dump provider did not specify a task runner affinity, dump on
// |dump_thread_|.
SequencedTaskRunner* task_runner = mdpinfo->task_runner.get();
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698