OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/discardable_shared_memory_heap.h" | 5 #include "content/common/discardable_shared_memory_heap.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/memory/discardable_shared_memory.h" | 10 #include "base/memory/discardable_shared_memory.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 | 389 |
390 base::trace_event::MemoryAllocatorDump* obj_dump = | 390 base::trace_event::MemoryAllocatorDump* obj_dump = |
391 pmd->CreateAllocatorDump(segment_dump_name + "/allocated_objects"); | 391 pmd->CreateAllocatorDump(segment_dump_name + "/allocated_objects"); |
392 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, | 392 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
393 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 393 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
394 static_cast<uint64_t>(allocated_objects_count)); | 394 static_cast<uint64_t>(allocated_objects_count)); |
395 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 395 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
396 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 396 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
397 static_cast<uint64_t>(allocated_objects_size_in_bytes)); | 397 static_cast<uint64_t>(allocated_objects_size_in_bytes)); |
398 | 398 |
399 // Total size of discardable memory segments locked by the clients. | |
400 const size_t locked_size = shared_memory->LockedSize(); | |
401 obj_dump->AddScalar("client_locked_size", | |
reveman
2015/09/29 12:29:10
I think it will be enough to dump the exact locked
ssid
2015/09/29 16:03:55
Sounds good.
| |
402 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | |
403 locked_size); | |
404 | |
405 // Size of the discardable segment actually locked by the platform | |
406 // independent lock. | |
407 obj_dump->AddScalar("actual_locked_size", | |
408 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | |
409 locked_size ? size : 0u); | |
410 | |
399 // Emit an ownership edge towards a global allocator dump node. This allows | 411 // Emit an ownership edge towards a global allocator dump node. This allows |
400 // to avoid double-counting segments when both browser and child process emit | 412 // to avoid double-counting segments when both browser and child process emit |
401 // them. In the special case of single-process-mode, this will be the only | 413 // them. In the special case of single-process-mode, this will be the only |
402 // dumper active and the single ownership edge will become a no-op in the UI. | 414 // dumper active and the single ownership edge will become a no-op in the UI. |
403 const uint64 tracing_process_id = | 415 const uint64 tracing_process_id = |
404 base::trace_event::MemoryDumpManager::GetInstance() | 416 base::trace_event::MemoryDumpManager::GetInstance() |
405 ->GetTracingProcessId(); | 417 ->GetTracingProcessId(); |
406 base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid = | 418 base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid = |
407 GetSegmentGUIDForTracing(tracing_process_id, segment_id); | 419 GetSegmentGUIDForTracing(tracing_process_id, segment_id); |
408 pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid); | 420 pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid); |
(...skipping 28 matching lines...) Expand all Loading... | |
437 ScopedVector<ScopedMemorySegment>::const_iterator it = | 449 ScopedVector<ScopedMemorySegment>::const_iterator it = |
438 std::find_if(memory_segments_.begin(), memory_segments_.end(), | 450 std::find_if(memory_segments_.begin(), memory_segments_.end(), |
439 [span](const ScopedMemorySegment* segment) { | 451 [span](const ScopedMemorySegment* segment) { |
440 return segment->ContainsSpan(span); | 452 return segment->ContainsSpan(span); |
441 }); | 453 }); |
442 DCHECK(it != memory_segments_.end()); | 454 DCHECK(it != memory_segments_.end()); |
443 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd); | 455 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd); |
444 } | 456 } |
445 | 457 |
446 } // namespace content | 458 } // namespace content |
OLD | NEW |