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

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: 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
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 for (const auto& buffer_entry : registered_buffers_) { 114 using base::trace_event::MemoryAllocatorDump;
115 int32_t buffer_id = buffer_entry.first; 115 using base::trace_event::MemoryDumpLevelOfDetail;
116 const Buffer* buffer = buffer_entry.second.get(); 116
117 std::string dump_name = 117 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
118 base::StringPrintf("gpu/transfer_memory/client_%d/buffer_%d", 118 std::string dump_name = base::StringPrintf("gpu/transfer_memory/client_%d",
119 memory_tracker_->ClientId(), buffer_id); 119 memory_tracker_->ClientId());
120 base::trace_event::MemoryAllocatorDump* dump = 120 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
121 pmd->CreateAllocatorDump(dump_name); 121 dump->AddScalar(MemoryAllocatorDump::kNameSize,
122 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 122 MemoryAllocatorDump::kUnitsBytes,
123 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 123 shared_memory_bytes_allocated_);
124 buffer->size()); 124 } else {
125 auto guid = 125 for (const auto& buffer_entry : registered_buffers_) {
126 GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id); 126 int32_t buffer_id = buffer_entry.first;
127 pmd->CreateSharedGlobalAllocatorDump(guid); 127 const Buffer* buffer = buffer_entry.second.get();
128 pmd->AddOwnershipEdge(dump->guid(), guid); 128 std::string dump_name =
129 base::StringPrintf("gpu/transfer_memory/client_%d/buffer_%d",
130 memory_tracker_->ClientId(), buffer_id);
131 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
132 dump->AddScalar(MemoryAllocatorDump::kNameSize,
133 MemoryAllocatorDump::kUnitsBytes, buffer->size());
134 auto guid = GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(),
135 buffer_id);
136 pmd->CreateSharedGlobalAllocatorDump(guid);
137 pmd->AddOwnershipEdge(dump->guid(), guid);
138 }
129 } 139 }
130 140
131 return true; 141 return true;
132 } 142 }
133 143
134 } // namespace gpu 144 } // namespace gpu
OLDNEW
« gpu/command_buffer/service/buffer_manager.cc ('K') | « 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