| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 while (offset < end) { | 350 while (offset < end) { |
| 351 Span* span = spans_[offset]; | 351 Span* span = spans_[offset]; |
| 352 if (!IsInFreeList(span)) { | 352 if (!IsInFreeList(span)) { |
| 353 allocated_objects_count++; | 353 allocated_objects_count++; |
| 354 allocated_objects_size_in_bytes += span->length_ * block_size_; | 354 allocated_objects_size_in_bytes += span->length_ * block_size_; |
| 355 } | 355 } |
| 356 offset += span->length_; | 356 offset += span->length_; |
| 357 } | 357 } |
| 358 | 358 |
| 359 std::string segment_dump_name = | 359 std::string segment_dump_name = |
| 360 base::StringPrintf("discardable/segment_%d", segment_id); | 360 base::StringPrintf("discardable/segments/segment_%d", segment_id); |
| 361 base::trace_event::MemoryAllocatorDump* segment_dump = | 361 base::trace_event::MemoryAllocatorDump* segment_dump = |
| 362 pmd->CreateAllocatorDump(segment_dump_name); | 362 pmd->CreateAllocatorDump(segment_dump_name); |
| 363 segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 363 segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 364 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 364 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 365 static_cast<uint64_t>(size)); | 365 static_cast<uint64_t>(size)); |
| 366 | 366 |
| 367 base::trace_event::MemoryAllocatorDump* obj_dump = | 367 base::trace_event::MemoryAllocatorDump* obj_dump = |
| 368 pmd->CreateAllocatorDump(segment_dump_name + "/allocated_objects"); | 368 pmd->CreateAllocatorDump(segment_dump_name + "/allocated_objects"); |
| 369 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectsCount, | 369 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectsCount, |
| 370 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 370 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 391 | 391 |
| 392 // static | 392 // static |
| 393 base::trace_event::MemoryAllocatorDumpGuid | 393 base::trace_event::MemoryAllocatorDumpGuid |
| 394 DiscardableSharedMemoryHeap::GetSegmentGUIDForTracing(uint64 tracing_process_id, | 394 DiscardableSharedMemoryHeap::GetSegmentGUIDForTracing(uint64 tracing_process_id, |
| 395 int32 segment_id) { | 395 int32 segment_id) { |
| 396 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf( | 396 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf( |
| 397 "discardable-x-process/%" PRIx64 "/%d", tracing_process_id, segment_id)); | 397 "discardable-x-process/%" PRIx64 "/%d", tracing_process_id, segment_id)); |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace content | 400 } // namespace content |
| OLD | NEW |