Chromium Code Reviews| Index: Source/platform/heap/Heap.cpp |
| diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp |
| index 71ffd4fe938cf55e8bbaf6f19b47d8f5c285fae0..6a47174f77250b02928bfd10e5a7787ae0289799 100644 |
| --- a/Source/platform/heap/Heap.cpp |
| +++ b/Source/platform/heap/Heap.cpp |
| @@ -445,6 +445,9 @@ Address BaseHeap::lazySweep(size_t allocationSize, size_t gcInfoIndex) |
| if (threadState()->isMainThread()) |
| ScriptForbiddenScope::exit(); |
| + |
| + Heap::reportMemoryUsageForTracing(); |
| + |
| return result; |
| } |
| @@ -481,11 +484,13 @@ bool BaseHeap::lazySweepWithDeadline(double deadlineSeconds) |
| if (pageCount % deadlineCheckInterval == 0) { |
| if (deadlineSeconds <= Platform::current()->monotonicallyIncreasingTime()) { |
| // Deadline has come. |
| + Heap::reportMemoryUsageForTracing(); |
| return !m_firstUnsweptPage; |
| } |
| } |
| pageCount++; |
| } |
| + Heap::reportMemoryUsageForTracing(); |
| return true; |
| } |
| @@ -498,6 +503,8 @@ void BaseHeap::completeSweep() |
| while (m_firstUnsweptPage) { |
| sweepUnsweptPage(); |
| } |
| + |
| + Heap::reportMemoryUsageForTracing(); |
|
haraken
2015/06/22 04:28:51
I think it's better to put Heap::reportMemoryUsage
Yuta Kitamura
2015/06/22 08:31:52
Correct me if I'm wrong, but I think no ThreadStat
|
| } |
| NormalPageHeap::NormalPageHeap(ThreadState* state, int index) |
| @@ -2190,6 +2197,18 @@ void Heap::reportMemoryUsageHistogram() |
| } |
| } |
| +#if ENABLE(GC_PROFILING) |
| +void Heap::reportMemoryUsageForTracing() |
| +{ |
| + // These values are divided by 1024 to avoid overflow in practical cases (TRACE_COUNTER values are 32-bit ints). |
| + // They are capped to INT_MAX just in case. |
| + TRACE_COUNTER1("blink_gc", "Heap::estimatedLiveObjectSizeKB", std::min(Heap::estimatedLiveObjectSize() / 1024, static_cast<size_t>(INT_MAX))); |
| + TRACE_COUNTER1("blink_gc", "Heap::allocatedObjectSizeKB", std::min(Heap::allocatedObjectSize() / 1024, static_cast<size_t>(INT_MAX))); |
| + TRACE_COUNTER1("blink_gc", "Heap::markedObjectSizeKB", std::min(Heap::markedObjectSize() / 1024, static_cast<size_t>(INT_MAX))); |
| + TRACE_COUNTER1("blink_gc", "Partitions::totalSizeOfCommittedPagesKB", std::min(WTF::Partitions::totalSizeOfCommittedPages() / 1024, static_cast<size_t>(INT_MAX))); |
| +} |
| +#endif |
| + |
| size_t Heap::objectPayloadSizeForTesting() |
| { |
| size_t objectPayloadSize = 0; |