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

Side by Side Diff: gpu/command_buffer/service/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/buffer_manager.h" 5 #include "gpu/command_buffer/service/buffer_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 break; 636 break;
637 } 637 }
638 if (primitive_restart_fixed_index_ != index) { 638 if (primitive_restart_fixed_index_ != index) {
639 glPrimitiveRestartIndex(index); 639 glPrimitiveRestartIndex(index);
640 primitive_restart_fixed_index_ = index; 640 primitive_restart_fixed_index_ = index;
641 } 641 }
642 } 642 }
643 643
644 bool BufferManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 644 bool BufferManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
645 base::trace_event::ProcessMemoryDump* pmd) { 645 base::trace_event::ProcessMemoryDump* pmd) {
646 const uint64_t share_group_tracing_guid = 646 using base::trace_event::MemoryAllocatorDump;
647 memory_tracker_->ShareGroupTracingGUID(); 647 using base::trace_event::MemoryDumpLevelOfDetail;
648 for (const auto& buffer_entry : buffers_) {
649 const auto& client_buffer_id = buffer_entry.first;
650 const auto& buffer = buffer_entry.second;
651 648
649 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
652 std::string dump_name = 650 std::string dump_name =
653 base::StringPrintf("gpu/gl/buffers/share_group_%" PRIu64 "/buffer_%d", 651 base::StringPrintf("gpu/gl/buffers/share_group_%" PRIu64 "",
654 share_group_tracing_guid, client_buffer_id); 652 memory_tracker_->ShareGroupTracingGUID());
655 base::trace_event::MemoryAllocatorDump* dump = 653 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
656 pmd->CreateAllocatorDump(dump_name); 654 dump->AddScalar(MemoryAllocatorDump::kNameSize,
657 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 655 MemoryAllocatorDump::kUnitsBytes, mem_represented());
ssid 2016/10/07 00:07:21 ditto
ericrk 2016/10/13 23:58:13 Done.
658 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 656 } else {
659 static_cast<uint64_t>(buffer->size())); 657 const uint64_t share_group_tracing_guid =
658 memory_tracker_->ShareGroupTracingGUID();
659 for (const auto& buffer_entry : buffers_) {
660 const auto& client_buffer_id = buffer_entry.first;
661 const auto& buffer = buffer_entry.second;
660 662
661 auto guid = gl::GetGLBufferGUIDForTracing(share_group_tracing_guid, 663 std::string dump_name =
662 client_buffer_id); 664 base::StringPrintf("gpu/gl/buffers/share_group_%" PRIu64 "/buffer_%d",
663 pmd->CreateSharedGlobalAllocatorDump(guid); 665 share_group_tracing_guid, client_buffer_id);
664 pmd->AddOwnershipEdge(dump->guid(), guid); 666 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
667 dump->AddScalar(MemoryAllocatorDump::kNameSize,
668 MemoryAllocatorDump::kUnitsBytes,
669 static_cast<uint64_t>(buffer->size()));
670
671 auto guid = gl::GetGLBufferGUIDForTracing(share_group_tracing_guid,
672 client_buffer_id);
673 pmd->CreateSharedGlobalAllocatorDump(guid);
674 pmd->AddOwnershipEdge(dump->guid(), guid);
675 }
665 } 676 }
666 return true; 677 return true;
667 } 678 }
668 679
669 } // namespace gles2 680 } // namespace gles2
670 } // namespace gpu 681 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698