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

Side by Side Diff: gpu/command_buffer/service/transfer_buffer_manager.cc

Issue 2382573002: Add BACKGROUND dump mode to various GPU/CC MemoryDumpProviders (Closed)
Patch Set: rebase Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 5 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 BufferMap::iterator it = registered_buffers_.find(id); 104 BufferMap::iterator it = registered_buffers_.find(id);
105 if (it == registered_buffers_.end()) 105 if (it == registered_buffers_.end())
106 return NULL; 106 return NULL;
107 107
108 return it->second; 108 return it->second;
109 } 109 }
110 110
111 bool TransferBufferManager::OnMemoryDump( 111 bool TransferBufferManager::OnMemoryDump(
112 const base::trace_event::MemoryDumpArgs& args, 112 const base::trace_event::MemoryDumpArgs& args,
113 base::trace_event::ProcessMemoryDump* pmd) { 113 base::trace_event::ProcessMemoryDump* pmd) {
114 using base::trace_event::MemoryAllocatorDump;
115 using base::trace_event::MemoryDumpLevelOfDetail;
116
117 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
118 std::string dump_name = base::StringPrintf("gpu/transfer_memory/client_%d",
119 memory_tracker_->ClientId());
120 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
121 dump->AddScalar(MemoryAllocatorDump::kNameSize,
122 MemoryAllocatorDump::kUnitsBytes,
123 shared_memory_bytes_allocated_);
124
125 // Early out, no need for more detail in a BACKGROUND dump.
126 return true;
127 }
128
114 for (const auto& buffer_entry : registered_buffers_) { 129 for (const auto& buffer_entry : registered_buffers_) {
115 int32_t buffer_id = buffer_entry.first; 130 int32_t buffer_id = buffer_entry.first;
116 const Buffer* buffer = buffer_entry.second.get(); 131 const Buffer* buffer = buffer_entry.second.get();
117 std::string dump_name = 132 std::string dump_name =
118 base::StringPrintf("gpu/transfer_memory/client_%d/buffer_%d", 133 base::StringPrintf("gpu/transfer_memory/client_%d/buffer_%d",
119 memory_tracker_->ClientId(), buffer_id); 134 memory_tracker_->ClientId(), buffer_id);
120 base::trace_event::MemoryAllocatorDump* dump = 135 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
121 pmd->CreateAllocatorDump(dump_name); 136 dump->AddScalar(MemoryAllocatorDump::kNameSize,
122 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 137 MemoryAllocatorDump::kUnitsBytes, buffer->size());
123 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
124 buffer->size());
125 auto guid = 138 auto guid =
126 GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id); 139 GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id);
127 pmd->CreateSharedGlobalAllocatorDump(guid); 140 pmd->CreateSharedGlobalAllocatorDump(guid);
128 pmd->AddOwnershipEdge(dump->guid(), guid); 141 pmd->AddOwnershipEdge(dump->guid(), guid);
129 } 142 }
130 143
131 return true; 144 return true;
132 } 145 }
133 146
134 } // namespace gpu 147 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698