void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebProcessMemoryDump* memoryDump) const { static const size_t kMaxURLReportLength = 128; const String dumpName = getMemoryDumpName(); WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(dumpName); dump->addScalar("encoded_size", "bytes", m_encodedSize); if (canDelete()) { dump->addScalar("dead_size", "bytes", m_encodedSize); } else { dump->addScalar("live_size", "bytes", m_encodedSize); } if (m_data) { dump->addScalar("purgeable_size", "bytes", isPurgeable() && !wasPurged() ? encodedSize() + overheadSize() : 0); m_data->onMemoryDump(dumpName, memoryDump); } if (levelOfDetail == WebMemoryDumpLevelOfDetail::Detailed) { String urlToReport = url().string(); if (urlToReport.length() > kMaxURLReportLength) { urlToReport.truncate(kMaxURLReportLength); urlToReport = urlToReport + "..."; } dump->addString("url", "", urlToReport); } const String overheadName = dumpName + "/metadata"; WebMemoryAllocatorDump* overheadDump = memoryDump->createMemoryAllocatorDump(overheadName); overheadDump->addScalar("size", "bytes", overheadSize()); memoryDump->addSuballocation(overheadDump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); }
void PurgeableVector::onMemoryDump(const String& dumpName, WebProcessMemoryDump* memoryDump) const { ASSERT(!(m_discardable && m_vector.size())); if (m_discardable) { WebMemoryAllocatorDump* dump = m_discardable->createMemoryAllocatorDump(dumpName, memoryDump); dump->addScalar("discardable_size", "bytes", m_discardableSize); } else if (m_vector.size()) { WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(dumpName); dump->addScalar("size", "bytes", m_vector.size()); memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); } }
void SharedBuffer::onMemoryDump(const String& dumpPrefix, WebProcessMemoryDump* memoryDump) const { if (m_buffer.size()) { WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(dumpPrefix + "/shared_buffer"); dump->addScalar("size", "bytes", m_buffer.size()); memoryDump->addSuballocation( dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); } else { // If there is data in the segments, then it should have been allocated // using fastMalloc. const String dataDumpName = dumpPrefix + "/segments"; auto dump = memoryDump->createMemoryAllocatorDump(dataDumpName); dump->addScalar("size", "bytes", m_size); memoryDump->addSuballocation( dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); } }
void PartitionStatsDumperImpl::partitionDumpTotals(const char* partitionName, const PartitionMemoryStats* memoryStats) { m_totalActiveBytes += memoryStats->totalActiveBytes; String dumpName = getPartitionDumpName(partitionName); WebMemoryAllocatorDump* allocatorDump = m_memoryDump->createMemoryAllocatorDump(dumpName); allocatorDump->addScalar("size", "bytes", memoryStats->totalResidentBytes); allocatorDump->addScalar("allocated_objects_size", "bytes", memoryStats->totalActiveBytes); allocatorDump->addScalar("virtual_size", "bytes", memoryStats->totalMmappedBytes); allocatorDump->addScalar("virtual_committed_size", "bytes", memoryStats->totalCommittedBytes); allocatorDump->addScalar("decommittable_size", "bytes", memoryStats->totalDecommittableBytes); allocatorDump->addScalar("discardable_size", "bytes", memoryStats->totalDiscardableBytes); }
void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebProcessMemoryDump* memoryDump) const { static const size_t kMaxURLReportLength = 128; static const int kMaxResourceClientToShowInMemoryInfra = 10; const String dumpName = getMemoryDumpName(); WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(dumpName); dump->addScalar("encoded_size", "bytes", m_encodedSize); if (canDelete()) { dump->addScalar("dead_size", "bytes", m_encodedSize); } else { dump->addScalar("live_size", "bytes", m_encodedSize); } if (m_data) { dump->addScalar("purgeable_size", "bytes", isPurgeable() && !wasPurged() ? encodedSize() + overheadSize() : 0); m_data->onMemoryDump(dumpName, memoryDump); } if (levelOfDetail == WebMemoryDumpLevelOfDetail::Detailed) { String urlToReport = url().string(); if (urlToReport.length() > kMaxURLReportLength) { urlToReport.truncate(kMaxURLReportLength); urlToReport = urlToReport + "..."; } dump->addString("url", "", urlToReport); dump->addString("reason_not_deletable", "", reasonNotDeletable()); Vector<String> clientNames; ResourceClientWalker<ResourceClient> walker(m_clients); while (ResourceClient* client = walker.next()) clientNames.append(client->debugName()); ResourceClientWalker<ResourceClient> walker2(m_clientsAwaitingCallback); while (ResourceClient* client = walker2.next()) clientNames.append("(awaiting) " + client->debugName()); ResourceClientWalker<ResourceClient> walker3(m_finishedClients); while (ResourceClient* client = walker3.next()) clientNames.append("(finished) " + client->debugName()); std::sort(clientNames.begin(), clientNames.end(), codePointCompareLessThan); StringBuilder builder; for (size_t i = 0; i < clientNames.size() && i < kMaxResourceClientToShowInMemoryInfra; ++i) { if (i > 0) builder.append(" / "); builder.append(clientNames[i]); } if (clientNames.size() > kMaxResourceClientToShowInMemoryInfra) { builder.append(" / and "); builder.appendNumber(clientNames.size() - kMaxResourceClientToShowInMemoryInfra); builder.append(" more"); } dump->addString("ResourceClient", "", builder.toString()); } const String overheadName = dumpName + "/metadata"; WebMemoryAllocatorDump* overheadDump = memoryDump->createMemoryAllocatorDump(overheadName); overheadDump->addScalar("size", "bytes", overheadSize()); memoryDump->addSuballocation(overheadDump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); }
void PartitionStatsDumperImpl::partitionsDumpBucketStats(const char* partitionName, const PartitionBucketMemoryStats* memoryStats) { ASSERT(memoryStats->isValid); String dumpName = getPartitionDumpName(partitionName); if (memoryStats->isDirectMap) dumpName.append(String::format("/directMap_%lu", ++m_uid)); else dumpName.append(String::format("/bucket_%u", static_cast<unsigned>(memoryStats->bucketSlotSize))); WebMemoryAllocatorDump* allocatorDump = m_memoryDump->createMemoryAllocatorDump(dumpName); allocatorDump->addScalar("size", "bytes", memoryStats->residentBytes); allocatorDump->addScalar("allocated_objects_size", "bytes", memoryStats->activeBytes); allocatorDump->addScalar("slot_size", "bytes", memoryStats->bucketSlotSize); allocatorDump->addScalar("decommittable_size", "bytes", memoryStats->decommittableBytes); allocatorDump->addScalar("discardable_size", "bytes", memoryStats->discardableBytes); allocatorDump->addScalar("total_pages_size", "bytes", memoryStats->allocatedPageSize); allocatorDump->addScalar("active_pages", "objects", memoryStats->numActivePages); allocatorDump->addScalar("full_pages", "objects", memoryStats->numFullPages); allocatorDump->addScalar("empty_pages", "objects", memoryStats->numEmptyPages); allocatorDump->addScalar("decommitted_pages", "objects", memoryStats->numDecommittedPages); }