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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 1272703003: Revert of [tracing] Throttle rate of heavy dumps and support to request light/heavy dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@light_dumps
Patch Set: Created 5 years, 4 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 | « base/trace_event/memory_dump_manager.h ('k') | 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 8c3d05a1e39ddf33b29693d37dd7782b86b7a15a..f9ba3ae5a134b23dcef8cfcb99a9e24a9e25fb44 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -43,7 +43,7 @@
const char kTraceCategory[] = TRACE_DISABLED_BY_DEFAULT("memory-infra");
// Throttle mmaps at a rate of once every kHeavyMmapsDumpsRate standard dumps.
-const int kHeavyDumpsRate = 8; // 250 ms * 8 = 2000 ms.
+const int kHeavyMmapsDumpsRate = 8; // 250 ms * 8 = 2000 ms.
const int kDumpIntervalMs = 250;
const int kTraceEventNumArgs = 1;
const char* kTraceEventArgNames[] = {"dumps"};
@@ -52,17 +52,16 @@
StaticAtomicSequenceNumber g_next_guid;
uint32 g_periodic_dumps_count = 0;
MemoryDumpManager* g_instance_for_testing = nullptr;
+MemoryDumpProvider* g_mmaps_dump_provider = nullptr;
void RequestPeriodicGlobalDump() {
- MemoryDumpArgs::LevelOfDetail dump_level_of_detail =
- g_periodic_dumps_count == 0 ? MemoryDumpArgs::LEVEL_OF_DETAIL_HIGH
- : MemoryDumpArgs::LEVEL_OF_DETAIL_LOW;
- if (++g_periodic_dumps_count == kHeavyDumpsRate)
+ MemoryDumpType dump_type = g_periodic_dumps_count == 0
+ ? MemoryDumpType::PERIODIC_INTERVAL_WITH_MMAPS
+ : MemoryDumpType::PERIODIC_INTERVAL;
+ if (++g_periodic_dumps_count == kHeavyMmapsDumpsRate)
g_periodic_dumps_count = 0;
- MemoryDumpArgs dump_args = {dump_level_of_detail};
- MemoryDumpManager::GetInstance()->RequestGlobalDump(
- MemoryDumpType::PERIODIC_INTERVAL, dump_args);
+ MemoryDumpManager::GetInstance()->RequestGlobalDump(dump_type);
}
} // namespace
@@ -119,7 +118,8 @@
#endif
#if defined(OS_LINUX) || defined(OS_ANDROID)
- RegisterDumpProvider(ProcessMemoryMapsDumpProvider::GetInstance());
+ g_mmaps_dump_provider = ProcessMemoryMapsDumpProvider::GetInstance();
+ RegisterDumpProvider(g_mmaps_dump_provider);
RegisterDumpProvider(MallocDumpProvider::GetInstance());
system_allocator_pool_name_ = MallocDumpProvider::kAllocatedObjects;
#endif
@@ -180,9 +180,9 @@
did_unregister_dump_provider_ = true;
}
-void MemoryDumpManager::RequestGlobalDump(MemoryDumpType dump_type,
- const MemoryDumpArgs& dump_args,
- const MemoryDumpCallback& callback) {
+void MemoryDumpManager::RequestGlobalDump(
+ MemoryDumpType dump_type,
+ const MemoryDumpCallback& callback) {
// Bail out immediately if tracing is not enabled at all.
if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_))) {
if (!callback.is_null())
@@ -204,16 +204,15 @@
if (delegate) {
// The delegate is in charge to coordinate the request among all the
// processes and call the CreateLocalDumpPoint on the local process.
- MemoryDumpRequestArgs args = {guid, dump_type, dump_args};
+ MemoryDumpRequestArgs args = {guid, dump_type};
delegate->RequestGlobalMemoryDump(args, callback);
} else if (!callback.is_null()) {
callback.Run(guid, false /* success */);
}
}
-void MemoryDumpManager::RequestGlobalDump(MemoryDumpType dump_type,
- const MemoryDumpArgs& dump_args) {
- RequestGlobalDump(dump_type, dump_args, MemoryDumpCallback());
+void MemoryDumpManager::RequestGlobalDump(MemoryDumpType dump_type) {
+ RequestGlobalDump(dump_type, MemoryDumpCallback());
}
void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
@@ -274,6 +273,15 @@
mdp = mdp_info->dump_provider;
if (mdp_info->disabled) {
skip_dump = true;
+ } else if (mdp == g_mmaps_dump_provider &&
+ pmd_async_state->req_args.dump_type !=
+ MemoryDumpType::PERIODIC_INTERVAL_WITH_MMAPS &&
+ pmd_async_state->req_args.dump_type !=
+ MemoryDumpType::EXPLICITLY_TRIGGERED) {
+ // Mmaps dumping is very heavyweight and cannot be performed at the same
+ // rate of other dumps. TODO(primiano): this is a hack and should be
+ // cleaned up as part of crbug.com/499731.
+ skip_dump = true;
} else if (mdp_info->task_runner &&
!mdp_info->task_runner->BelongsToCurrentThread()) {
// It's time to hop onto another thread.
@@ -304,9 +312,13 @@
bool finalize = false;
bool dump_successful = false;
+ // TODO(ssid): Change RequestGlobalDump to use MemoryDumpArgs along with
+ // MemoryDumpType to get request for light / heavy dump, and remove this
+ // constant.
if (!skip_dump) {
- dump_successful = mdp->OnMemoryDump(pmd_async_state->req_args.dump_args,
- &pmd_async_state->process_memory_dump);
+ MemoryDumpArgs dump_args = {MemoryDumpArgs::LEVEL_OF_DETAIL_HIGH};
+ dump_successful =
+ mdp->OnMemoryDump(dump_args, &pmd_async_state->process_memory_dump);
}
{
« no previous file with comments | « base/trace_event/memory_dump_manager.h ('k') | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698