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

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

Issue 2473983003: Use share group tracing ID for renderbuffer memory dump (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | « no previous file | 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/renderbuffer_manager.h" 5 #include "gpu/command_buffer/service/renderbuffer_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/format_macros.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/trace_event/memory_dump_manager.h" 14 #include "base/trace_event/memory_dump_manager.h"
14 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
15 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 16 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
16 #include "gpu/command_buffer/service/feature_info.h" 17 #include "gpu/command_buffer/service/feature_info.h"
17 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
18 #include "gpu/command_buffer/service/memory_tracking.h" 19 #include "gpu/command_buffer/service/memory_tracking.h"
19 #include "ui/gl/gl_implementation.h" 20 #include "ui/gl/gl_implementation.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return GL_DEPTH_COMPONENT24; 246 return GL_DEPTH_COMPONENT24;
246 } 247 }
247 return impl_format; 248 return impl_format;
248 } 249 }
249 250
250 bool RenderbufferManager::OnMemoryDump( 251 bool RenderbufferManager::OnMemoryDump(
251 const base::trace_event::MemoryDumpArgs& args, 252 const base::trace_event::MemoryDumpArgs& args,
252 base::trace_event::ProcessMemoryDump* pmd) { 253 base::trace_event::ProcessMemoryDump* pmd) {
253 using base::trace_event::MemoryAllocatorDump; 254 using base::trace_event::MemoryAllocatorDump;
254 using base::trace_event::MemoryDumpLevelOfDetail; 255 using base::trace_event::MemoryDumpLevelOfDetail;
256 const uint64_t share_group_tracing_guid =
257 memory_tracker_->ShareGroupTracingGUID();
255 258
256 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) { 259 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
257 std::string dump_name = base::StringPrintf( 260 std::string dump_name =
258 "gpu/gl/renderbuffers/client_%d/", memory_tracker_->ClientId()); 261 base::StringPrintf("gpu/gl/renderbuffers/share_group_%" PRIu64 "/",
262 share_group_tracing_guid);
259 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); 263 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
260 dump->AddScalar(MemoryAllocatorDump::kNameSize, 264 dump->AddScalar(MemoryAllocatorDump::kNameSize,
261 MemoryAllocatorDump::kUnitsBytes, mem_represented()); 265 MemoryAllocatorDump::kUnitsBytes, mem_represented());
262 266
263 // Early out, no need for more detail in a BACKGROUND dump. 267 // Early out, no need for more detail in a BACKGROUND dump.
264 return true; 268 return true;
265 } 269 }
266 270
267 int client_id = memory_tracker_->ClientId();
268 for (const auto& renderbuffer_entry : renderbuffers_) { 271 for (const auto& renderbuffer_entry : renderbuffers_) {
269 const auto& client_renderbuffer_id = renderbuffer_entry.first; 272 const auto& client_renderbuffer_id = renderbuffer_entry.first;
270 const auto& renderbuffer = renderbuffer_entry.second; 273 const auto& renderbuffer = renderbuffer_entry.second;
271 274
272 std::string dump_name = 275 std::string dump_name = base::StringPrintf(
273 base::StringPrintf("gpu/gl/renderbuffers/client_%d/renderbuffer_%d", 276 "gpu/gl/renderbuffers/share_group_%" PRIu64 "/renderbuffer_%d",
274 client_id, client_renderbuffer_id); 277 share_group_tracing_guid, client_renderbuffer_id);
275 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); 278 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
276 dump->AddScalar(MemoryAllocatorDump::kNameSize, 279 dump->AddScalar(MemoryAllocatorDump::kNameSize,
277 MemoryAllocatorDump::kUnitsBytes, 280 MemoryAllocatorDump::kUnitsBytes,
278 static_cast<uint64_t>(renderbuffer->EstimatedSize())); 281 static_cast<uint64_t>(renderbuffer->EstimatedSize()));
279 282
280 auto guid = gl::GetGLRenderbufferGUIDForTracing( 283 auto guid = gl::GetGLRenderbufferGUIDForTracing(share_group_tracing_guid,
281 memory_tracker_->ShareGroupTracingGUID(), client_renderbuffer_id); 284 client_renderbuffer_id);
282 pmd->CreateSharedGlobalAllocatorDump(guid); 285 pmd->CreateSharedGlobalAllocatorDump(guid);
283 pmd->AddOwnershipEdge(dump->guid(), guid); 286 pmd->AddOwnershipEdge(dump->guid(), guid);
284 } 287 }
285 288
286 return true; 289 return true;
287 } 290 }
288 291
289 } // namespace gles2 292 } // namespace gles2
290 } // namespace gpu 293 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698