Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: Source/platform/heap/Heap.cpp

Issue 1203493004: [tracing] Adding class-wise memory statistics to blink gc memory dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Disabling the classes dump, avoid double counting, and comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 size_t deadSize = 0; 1505 size_t deadSize = 0;
1506 size_t freeSize = 0; 1506 size_t freeSize = 0;
1507 for (Address headerAddress = payload(); headerAddress < payloadEnd(); header Address += header->size()) { 1507 for (Address headerAddress = payload(); headerAddress < payloadEnd(); header Address += header->size()) {
1508 header = reinterpret_cast<HeapObjectHeader*>(headerAddress); 1508 header = reinterpret_cast<HeapObjectHeader*>(headerAddress);
1509 if (header->isFree()) { 1509 if (header->isFree()) {
1510 freeCount++; 1510 freeCount++;
1511 freeSize += header->size(); 1511 freeSize += header->size();
1512 } else if (header->isMarked()) { 1512 } else if (header->isMarked()) {
1513 liveCount++; 1513 liveCount++;
1514 liveSize += header->size(); 1514 liveSize += header->size();
1515
1516 size_t tag = info.getClassTag(header->gcInfoIndex());
1517 info.liveCount[tag]++;
1518 info.liveSize[tag] += header->size();
1515 } else { 1519 } else {
1516 deadCount++; 1520 deadCount++;
1517 deadSize += header->size(); 1521 deadSize += header->size();
1522
1523 size_t tag = info.getClassTag(header->gcInfoIndex());
1524 info.deadCount[tag]++;
1525 info.deadSize[tag] += header->size();
1518 } 1526 }
1519 } 1527 }
1520 1528
1521 info.currentHeapFreeCount += freeCount; 1529 info.currentHeapFreeCount += freeCount;
1522 info.currentHeapFreeSize += freeSize; 1530 info.currentHeapFreeSize += freeSize;
1523 1531
1524 pageDump->AddScalar("live_count", "objects", liveCount); 1532 pageDump->AddScalar("live_count", "objects", liveCount);
1525 pageDump->AddScalar("dead_count", "objects", deadCount); 1533 pageDump->AddScalar("dead_count", "objects", deadCount);
1526 pageDump->AddScalar("free_count", "objects", freeCount); 1534 pageDump->AddScalar("free_count", "objects", freeCount);
1527 pageDump->AddScalar("live_size", "bytes", liveSize); 1535 pageDump->AddScalar("live_size", "bytes", liveSize);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex, ThreadStat e::GCSnapshotInfo& info) 1715 void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex, ThreadStat e::GCSnapshotInfo& info)
1708 { 1716 {
1709 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex))); 1717 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex)));
1710 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); 1718 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName);
1711 1719
1712 size_t liveSize = 0; 1720 size_t liveSize = 0;
1713 size_t deadSize = 0; 1721 size_t deadSize = 0;
1714 size_t liveCount = 0; 1722 size_t liveCount = 0;
1715 size_t deadCount = 0; 1723 size_t deadCount = 0;
1716 HeapObjectHeader* header = heapObjectHeader(); 1724 HeapObjectHeader* header = heapObjectHeader();
1725 size_t tag = info.getClassTag(header->gcInfoIndex());
1717 if (header->isMarked()) { 1726 if (header->isMarked()) {
1718 liveCount = 1; 1727 liveCount = 1;
1719 liveSize += header->size(); 1728 liveSize += header->payloadSize();
1729 info.liveCount[tag]++;
1730 info.liveSize[tag] += header->size();
1720 } else { 1731 } else {
1721 deadCount = 1; 1732 deadCount = 1;
1722 deadSize += header->size(); 1733 deadSize += header->payloadSize();
1734 info.deadCount[tag]++;
1735 info.deadSize[tag] += header->size();
1723 } 1736 }
1724 1737
1725 pageDump->AddScalar("live_count", "objects", liveCount); 1738 pageDump->AddScalar("live_count", "objects", liveCount);
1726 pageDump->AddScalar("dead_count", "objects", deadCount); 1739 pageDump->AddScalar("dead_count", "objects", deadCount);
1727 pageDump->AddScalar("live_size", "bytes", liveSize); 1740 pageDump->AddScalar("live_size", "bytes", liveSize);
1728 pageDump->AddScalar("dead_size", "bytes", deadSize); 1741 pageDump->AddScalar("dead_size", "bytes", deadSize);
1729 } 1742 }
1730 1743
1731 #if ENABLE(GC_PROFILING) 1744 #if ENABLE(GC_PROFILING)
1732 const GCInfo* LargeObjectPage::findGCInfo(Address address) 1745 const GCInfo* LargeObjectPage::findGCInfo(Address address)
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 size_t Heap::s_allocatedObjectSize = 0; 2464 size_t Heap::s_allocatedObjectSize = 0;
2452 size_t Heap::s_allocatedSpace = 0; 2465 size_t Heap::s_allocatedSpace = 0;
2453 size_t Heap::s_markedObjectSize = 0; 2466 size_t Heap::s_markedObjectSize = 0;
2454 // We don't want to use 0 KB for the initial value because it may end up 2467 // We don't want to use 0 KB for the initial value because it may end up
2455 // triggering the first GC of some thread too prematurely. 2468 // triggering the first GC of some thread too prematurely.
2456 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; 2469 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024;
2457 size_t Heap::s_externalObjectSizeAtLastGC = 0; 2470 size_t Heap::s_externalObjectSizeAtLastGC = 0;
2458 double Heap::s_estimatedMarkingTimePerByte = 0.0; 2471 double Heap::s_estimatedMarkingTimePerByte = 0.0;
2459 2472
2460 } // namespace blink 2473 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698