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

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.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 // This file contains the implementation of the command buffer helper class. 5 // This file contains the implementation of the command buffer helper class.
6 6
7 #include "gpu/command_buffer/client/cmd_buffer_helper.h" 7 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return current_get_offset - put_ - 1; 333 return current_get_offset - put_ - 1;
334 } else { 334 } else {
335 return current_get_offset + total_entry_count_ - put_ - 335 return current_get_offset + total_entry_count_ - put_ -
336 (current_get_offset == 0 ? 1 : 0); 336 (current_get_offset == 0 ? 1 : 0);
337 } 337 }
338 } 338 }
339 339
340 bool CommandBufferHelper::OnMemoryDump( 340 bool CommandBufferHelper::OnMemoryDump(
341 const base::trace_event::MemoryDumpArgs& args, 341 const base::trace_event::MemoryDumpArgs& args,
342 base::trace_event::ProcessMemoryDump* pmd) { 342 base::trace_event::ProcessMemoryDump* pmd) {
343 using base::trace_event::MemoryAllocatorDump;
344 using base::trace_event::MemoryDumpLevelOfDetail;
345
343 if (!HaveRingBuffer()) 346 if (!HaveRingBuffer())
344 return true; 347 return true;
345 348
346 const uint64_t tracing_process_id = 349 const uint64_t tracing_process_id =
347 base::trace_event::MemoryDumpManager::GetInstance() 350 base::trace_event::MemoryDumpManager::GetInstance()
348 ->GetTracingProcessId(); 351 ->GetTracingProcessId();
349 352
350 base::trace_event::MemoryAllocatorDump* dump = 353 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf(
351 pmd->CreateAllocatorDump(base::StringPrintf( 354 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_));
352 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_)); 355 dump->AddScalar(MemoryAllocatorDump::kNameSize,
353 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 356 MemoryAllocatorDump::kUnitsBytes, ring_buffer_size_);
354 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 357
355 ring_buffer_size_); 358 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) {
356 dump->AddScalar("free_size", 359 dump->AddScalar(
357 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 360 "free_size", MemoryAllocatorDump::kUnitsBytes,
358 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry)); 361 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry));
359 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_); 362 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_);
360 const int kImportance = 2; 363 const int kImportance = 2;
361 pmd->CreateSharedGlobalAllocatorDump(guid); 364 pmd->CreateSharedGlobalAllocatorDump(guid);
362 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 365 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
366 }
363 367
364 return true; 368 return true;
365 } 369 }
366 370
367 } // namespace gpu 371 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698