| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
| 6 #include "Source/platform/PartitionAllocMemoryDumpProvider.h" | 6 #include "Source/platform/PartitionAllocMemoryDumpProvider.h" |
| 7 | 7 |
| 8 #include "public/platform/WebMemoryAllocatorDump.h" | 8 #include "public/platform/WebMemoryAllocatorDump.h" |
| 9 #include "public/platform/WebProcessMemoryDump.h" | 9 #include "public/platform/WebProcessMemoryDump.h" |
| 10 #include "wtf/Partitions.h" | 10 #include "wtf/Partitions.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 void partitionsDumpBucketStats(const char* partitionName, const PartitionBuc
ketMemoryStats*) override; | 27 void partitionsDumpBucketStats(const char* partitionName, const PartitionBuc
ketMemoryStats*) override; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 WebProcessMemoryDump* m_memoryDump; | 30 WebProcessMemoryDump* m_memoryDump; |
| 31 size_t m_uid; | 31 size_t m_uid; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 void PartitionStatsDumperImpl::partitionsDumpBucketStats(const char* partitionNa
me, const PartitionBucketMemoryStats* memoryStats) | 34 void PartitionStatsDumperImpl::partitionsDumpBucketStats(const char* partitionNa
me, const PartitionBucketMemoryStats* memoryStats) |
| 35 { | 35 { |
| 36 ASSERT(memoryStats->isValid); | 36 ASSERT(memoryStats->isValid); |
| 37 String format; | 37 String dumpName; |
| 38 if (memoryStats->isDirectMap) | 38 if (memoryStats->isDirectMap) |
| 39 format = String::format("partition_alloc/%s/directMap_%zu", partitionNam
e, ++m_uid); | 39 dumpName = String::format("partition_alloc/%s/directMap_%zu", partitionN
ame, ++m_uid); |
| 40 else | 40 else |
| 41 format = String::format("partition_alloc/%s/bucket_%zu", partitionName,
static_cast<size_t>(memoryStats->bucketSlotSize)); | 41 dumpName = String::format("partition_alloc/%s/bucket_%zu", partitionName
, static_cast<size_t>(memoryStats->bucketSlotSize)); |
| 42 | 42 |
| 43 WebMemoryAllocatorDump* allocatorDump = m_memoryDump->createMemoryAllocatorD
ump(format); | 43 WebMemoryAllocatorDump* allocatorDump = m_memoryDump->createMemoryAllocatorD
ump(dumpName); |
| 44 allocatorDump->AddScalar("size", "bytes", memoryStats->residentBytes); |
| 45 allocatorDump->AddScalar("waste_size", "bytes", memoryStats->pageWasteSize); |
| 44 allocatorDump->AddScalar("partition_page_size", "bytes", memoryStats->alloca
tedPageSize); | 46 allocatorDump->AddScalar("partition_page_size", "bytes", memoryStats->alloca
tedPageSize); |
| 45 allocatorDump->AddScalar("waste_size", "bytes", memoryStats->pageWasteSize); | |
| 46 allocatorDump->AddScalar("inner_size", "bytes", memoryStats->activeBytes); | |
| 47 allocatorDump->AddScalar("outer_size", "bytes", memoryStats->residentBytes); | |
| 48 allocatorDump->AddScalar("freeable_size", "bytes", memoryStats->freeableByte
s); | 47 allocatorDump->AddScalar("freeable_size", "bytes", memoryStats->freeableByte
s); |
| 49 allocatorDump->AddScalar("full_partition_pages", "objects", memoryStats->num
FullPages); | 48 allocatorDump->AddScalar("full_partition_pages", "objects", memoryStats->num
FullPages); |
| 50 allocatorDump->AddScalar("active_partition_pages", "objects", memoryStats->n
umActivePages); | 49 allocatorDump->AddScalar("active_partition_pages", "objects", memoryStats->n
umActivePages); |
| 51 allocatorDump->AddScalar("empty_partition_pages", "objects", memoryStats->nu
mEmptyPages); | 50 allocatorDump->AddScalar("empty_partition_pages", "objects", memoryStats->nu
mEmptyPages); |
| 52 allocatorDump->AddScalar("decommitted_partition_pages", "objects", memorySta
ts->numDecommittedPages); | 51 allocatorDump->AddScalar("decommitted_partition_pages", "objects", memorySta
ts->numDecommittedPages); |
| 52 |
| 53 dumpName = dumpName + "/allocated_objects"; |
| 54 WebMemoryAllocatorDump* objectsDump = m_memoryDump->createMemoryAllocatorDum
p(dumpName); |
| 55 objectsDump->AddScalar("size", "bytes", memoryStats->activeBytes); |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace | 58 } // namespace |
| 56 | 59 |
| 57 PartitionAllocMemoryDumpProvider* PartitionAllocMemoryDumpProvider::instance() | 60 PartitionAllocMemoryDumpProvider* PartitionAllocMemoryDumpProvider::instance() |
| 58 { | 61 { |
| 59 DEFINE_STATIC_LOCAL(PartitionAllocMemoryDumpProvider, instance, ()); | 62 DEFINE_STATIC_LOCAL(PartitionAllocMemoryDumpProvider, instance, ()); |
| 60 return &instance; | 63 return &instance; |
| 61 } | 64 } |
| 62 | 65 |
| 63 bool PartitionAllocMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump*
memoryDump) | 66 bool PartitionAllocMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump*
memoryDump) |
| 64 { | 67 { |
| 65 PartitionStatsDumperImpl partitionStatsDumper(memoryDump); | 68 PartitionStatsDumperImpl partitionStatsDumper(memoryDump); |
| 66 | 69 |
| 67 // This method calls memoryStats.partitionsDumpBucketStats with memory stati
stics. | 70 // This method calls memoryStats.partitionsDumpBucketStats with memory stati
stics. |
| 68 WTF::Partitions::dumpMemoryStats(&partitionStatsDumper); | 71 WTF::Partitions::dumpMemoryStats(&partitionStatsDumper); |
| 69 return true; | 72 return true; |
| 70 } | 73 } |
| 71 | 74 |
| 72 PartitionAllocMemoryDumpProvider::PartitionAllocMemoryDumpProvider() | 75 PartitionAllocMemoryDumpProvider::PartitionAllocMemoryDumpProvider() |
| 73 { | 76 { |
| 74 } | 77 } |
| 75 | 78 |
| 76 PartitionAllocMemoryDumpProvider::~PartitionAllocMemoryDumpProvider() | 79 PartitionAllocMemoryDumpProvider::~PartitionAllocMemoryDumpProvider() |
| 77 { | 80 { |
| 78 } | 81 } |
| 79 | 82 |
| 80 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |