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

Unified Diff: gpu/command_buffer/service/texture_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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index dbe95db5b0987cc247aae5d060983263bef23dea..7944b5151dddcd4536dc9e9bc2105cfdc711ad8a 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -34,6 +34,9 @@
#include "ui/gl/gl_version_info.h"
#include "ui/gl/trace_util.h"
+using base::trace_event::MemoryAllocatorDump;
+using base::trace_event::MemoryDumpLevelOfDetail;
+
namespace gpu {
namespace gles2 {
@@ -1681,12 +1684,10 @@ void Texture::DumpLevelMemory(base::trace_event::ProcessMemoryDump* pmd,
// texture allocation also as the storage is not provided by the
// GLImage in that case.
if (level_infos[level_index].image_state != BOUND) {
- base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(
- base::StringPrintf("%s/face_%d/level_%d", dump_name.c_str(),
- face_index, level_index));
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf(
+ "%s/face_%d/level_%d", dump_name.c_str(), face_index, level_index));
dump->AddScalar(
- base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ MemoryAllocatorDump::kNameSize, MemoryAllocatorDump::kUnitsBytes,
static_cast<uint64_t>(level_infos[level_index].estimated_size));
}
}
@@ -3131,8 +3132,21 @@ ScopedTextureUploadTimer::~ScopedTextureUploadTimer() {
bool TextureManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
+ if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
+ std::string dump_name =
+ base::StringPrintf("gpu/gl/textures/share_group_%" PRIu64 "",
+ memory_tracker_->ShareGroupTracingGUID());
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
+ dump->AddScalar(MemoryAllocatorDump::kNameSize,
+ MemoryAllocatorDump::kUnitsBytes, mem_represented());
+
+ // Early out, no need for more detail in a BACKGROUND dump.
+ return true;
+ }
+
for (const auto& resource : textures_) {
- // Only dump memory info for textures actually owned by this TextureManager.
+ // Only dump memory info for textures actually owned by this
+ // TextureManager.
DumpTextureRef(pmd, resource.second.get());
}
@@ -3158,10 +3172,9 @@ void TextureManager::DumpTextureRef(base::trace_event::ProcessMemoryDump* pmd,
"gpu/gl/textures/share_group_%" PRIu64 "/texture_%d",
memory_tracker_->ShareGroupTracingGUID(), ref->client_id());
- base::trace_event::MemoryAllocatorDump* dump =
- pmd->CreateAllocatorDump(dump_name);
- dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
+ dump->AddScalar(MemoryAllocatorDump::kNameSize,
+ MemoryAllocatorDump::kUnitsBytes,
static_cast<uint64_t>(size));
// Add the |client_guid| which expresses shared ownership with the client
« no previous file with comments | « gpu/command_buffer/service/renderbuffer_manager.cc ('k') | gpu/command_buffer/service/transfer_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698