OLD | NEW |
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> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/shared_memory_dump_provider.h" |
13 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
16 #include "base/trace_event/memory_allocator_dump.h" | 17 #include "base/trace_event/memory_allocator_dump.h" |
17 #include "base/trace_event/memory_dump_manager.h" | 18 #include "base/trace_event/memory_dump_manager.h" |
18 #include "base/trace_event/process_memory_dump.h" | 19 #include "base/trace_event/process_memory_dump.h" |
19 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
20 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 21 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 22 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
22 #include "gpu/command_buffer/service/memory_tracking.h" | 23 #include "gpu/command_buffer/service/memory_tracking.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 using base::trace_event::MemoryAllocatorDump; | 115 using base::trace_event::MemoryAllocatorDump; |
115 using base::trace_event::MemoryDumpLevelOfDetail; | 116 using base::trace_event::MemoryDumpLevelOfDetail; |
116 | 117 |
117 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) { | 118 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) { |
118 std::string dump_name = base::StringPrintf("gpu/transfer_memory/client_%d", | 119 std::string dump_name = base::StringPrintf("gpu/transfer_memory/client_%d", |
119 memory_tracker_->ClientId()); | 120 memory_tracker_->ClientId()); |
120 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); | 121 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
121 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 122 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
122 MemoryAllocatorDump::kUnitsBytes, | 123 MemoryAllocatorDump::kUnitsBytes, |
123 shared_memory_bytes_allocated_); | 124 shared_memory_bytes_allocated_); |
| 125 base::SharedMemoryDumpProvider::GetInstance()->AddSuballocation( |
| 126 pmd, dump->guid()); |
124 | 127 |
125 // Early out, no need for more detail in a BACKGROUND dump. | 128 // Early out, no need for more detail in a BACKGROUND dump. |
126 return true; | 129 return true; |
127 } | 130 } |
128 | 131 |
129 for (const auto& buffer_entry : registered_buffers_) { | 132 for (const auto& buffer_entry : registered_buffers_) { |
130 int32_t buffer_id = buffer_entry.first; | 133 int32_t buffer_id = buffer_entry.first; |
131 const Buffer* buffer = buffer_entry.second.get(); | 134 const Buffer* buffer = buffer_entry.second.get(); |
132 std::string dump_name = | 135 std::string dump_name = |
133 base::StringPrintf("gpu/transfer_memory/client_%d/buffer_%d", | 136 base::StringPrintf("gpu/transfer_memory/client_%d/buffer_%d", |
134 memory_tracker_->ClientId(), buffer_id); | 137 memory_tracker_->ClientId(), buffer_id); |
135 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); | 138 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
136 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 139 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
137 MemoryAllocatorDump::kUnitsBytes, buffer->size()); | 140 MemoryAllocatorDump::kUnitsBytes, buffer->size()); |
138 auto guid = | 141 auto guid = |
139 GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id); | 142 GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id); |
140 pmd->CreateSharedGlobalAllocatorDump(guid); | 143 pmd->CreateSharedGlobalAllocatorDump(guid); |
141 pmd->AddOwnershipEdge(dump->guid(), guid); | 144 pmd->AddOwnershipEdge(dump->guid(), guid); |
142 } | 145 } |
143 | 146 |
144 return true; | 147 return true; |
145 } | 148 } |
146 | 149 |
147 } // namespace gpu | 150 } // namespace gpu |
OLD | NEW |