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 // 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 Loading... |
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 | |
346 if (!HaveRingBuffer()) | 343 if (!HaveRingBuffer()) |
347 return true; | 344 return true; |
348 | 345 |
349 const uint64_t tracing_process_id = | 346 const uint64_t tracing_process_id = |
350 base::trace_event::MemoryDumpManager::GetInstance() | 347 base::trace_event::MemoryDumpManager::GetInstance() |
351 ->GetTracingProcessId(); | 348 ->GetTracingProcessId(); |
352 | 349 |
353 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( | 350 base::trace_event::MemoryAllocatorDump* dump = |
354 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_)); | 351 pmd->CreateAllocatorDump(base::StringPrintf( |
355 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 352 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_)); |
356 MemoryAllocatorDump::kUnitsBytes, ring_buffer_size_); | 353 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
357 | 354 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
358 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) { | 355 ring_buffer_size_); |
359 dump->AddScalar( | 356 dump->AddScalar("free_size", |
360 "free_size", MemoryAllocatorDump::kUnitsBytes, | 357 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
361 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry)); | 358 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry)); |
362 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_); | 359 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_); |
363 const int kImportance = 2; | 360 const int kImportance = 2; |
364 pmd->CreateSharedGlobalAllocatorDump(guid); | 361 pmd->CreateSharedGlobalAllocatorDump(guid); |
365 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 362 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
366 } | |
367 | 363 |
368 return true; | 364 return true; |
369 } | 365 } |
370 | 366 |
371 } // namespace gpu | 367 } // namespace gpu |
OLD | NEW |