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

Unified Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 2382573002: Add BACKGROUND dump mode to various GPU/CC MemoryDumpProviders (Closed)
Patch Set: Created 4 years, 3 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: gpu/command_buffer/client/mapped_memory.cc
diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
index 06f1f63e0c9c01e77aecb84be13364ec377bc4dd..dc9fb02d9bcb2dc318bb53deeaef632c90ae7c74 100644
--- a/gpu/command_buffer/client/mapped_memory.cc
+++ b/gpu/command_buffer/client/mapped_memory.cc
@@ -169,30 +169,37 @@ void MappedMemoryManager::FreeUnused() {
bool MappedMemoryManager::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
- const uint64_t tracing_process_id =
- base::trace_event::MemoryDumpManager::GetInstance()
- ->GetTracingProcessId();
-
- for (const auto& chunk : chunks_) {
- std::string dump_name = base::StringPrintf(
- "gpu/mapped_memory/manager_%d/chunk_%d", tracing_id_, chunk->shm_id());
- base::trace_event::MemoryAllocatorDump* dump =
- pmd->CreateAllocatorDump(dump_name);
-
- dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- chunk->GetSize());
- dump->AddScalar("free_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- chunk->GetFreeSize());
-
- auto guid = GetBufferGUIDForTracing(tracing_process_id, chunk->shm_id());
-
- const int kImportance = 2;
- pmd->CreateSharedGlobalAllocatorDump(guid);
- pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
+ using base::trace_event::MemoryAllocatorDump;
+ using base::trace_event::MemoryDumpLevelOfDetail;
+
+ if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
+ std::string dump_name =
+ base::StringPrintf("gpu/mapped_memory/manager_%d", tracing_id_);
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
+ dump->AddScalar(MemoryAllocatorDump::kNameSize,
+ MemoryAllocatorDump::kUnitsBytes, allocated_memory_);
ssid 2016/10/07 00:07:21 return here?
ericrk 2016/10/13 23:58:13 Done.
+ } else {
+ const uint64_t tracing_process_id =
+ base::trace_event::MemoryDumpManager::GetInstance()
+ ->GetTracingProcessId();
+ for (const auto& chunk : chunks_) {
+ std::string dump_name =
+ base::StringPrintf("gpu/mapped_memory/manager_%d/chunk_%d",
+ tracing_id_, chunk->shm_id());
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
+
+ dump->AddScalar(MemoryAllocatorDump::kNameSize,
+ MemoryAllocatorDump::kUnitsBytes, chunk->GetSize());
+ dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes,
+ chunk->GetFreeSize());
+
+ auto guid = GetBufferGUIDForTracing(tracing_process_id, chunk->shm_id());
+
+ const int kImportance = 2;
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
+ }
}
-
return true;
}

Powered by Google App Engine
This is Rietveld 408576698