Index: Source/platform/heap/Heap.cpp |
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp |
index e353c609c3997c679011fc392b577ff1d2ea9311..b5ebff3bc99fe476babed99ab71988174ab57ecf 100644 |
--- a/Source/platform/heap/Heap.cpp |
+++ b/Source/platform/heap/Heap.cpp |
@@ -33,6 +33,7 @@ |
#include "platform/TraceEvent.h" |
#include "platform/heap/ThreadState.h" |
+#include "public/platform/Platform.h" |
#include "wtf/Assertions.h" |
#include "wtf/LeakAnnotations.h" |
#include "wtf/PassOwnPtr.h" |
@@ -1648,6 +1649,7 @@ void Heap::collectGarbage(ThreadState::StackState stackState) |
TRACE_EVENT0("Blink", "Heap::collectGarbage"); |
TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BlinkGC"); |
+ double timeStamp = WTF::currentTimeMS(); |
#if ENABLE(GC_TRACING) |
static_cast<MarkingVisitor*>(s_markingVisitor)->objectGraph().clear(); |
#endif |
@@ -1674,6 +1676,11 @@ void Heap::collectGarbage(ThreadState::StackState stackState) |
#if ENABLE(GC_TRACING) |
static_cast<MarkingVisitor*>(s_markingVisitor)->reportStats(); |
#endif |
+ |
+ if (blink::Platform::current()) { |
+ blink::Platform::current()->histogramEnumeration("BlinkGC.CollectGarbage", WTF::currentTimeMS() - timeStamp, 30000); |
+ blink::Platform::current()->histogramEnumeration("BlinkGC.TotalObjectSpaceInAllThreads", totalObjectSpaceInAllThreads() / 1024, 8 * 1024 * 1024); |
+ } |
} |
void Heap::collectAllGarbage() |
@@ -1692,6 +1699,18 @@ void Heap::setForcePreciseGCForTesting() |
ThreadState::current()->setForcePreciseGCForTesting(true); |
} |
+uint64_t Heap::totalObjectSpaceInAllThreads() |
Mads Ager (chromium)
2014/05/28 09:35:45
Let do totalAllocatedSpaceInAllThreads and report
haraken
2014/05/28 10:40:26
Done.
|
+{ |
+ uint64_t count = 0; |
+ ASSERT(ThreadState::isAnyThreadInGC()); |
+ ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads(); |
+ typedef ThreadState::AttachedThreadStateSet::iterator ThreadStateIterator; |
+ for (ThreadStateIterator it = threads.begin(), end = threads.end(); it != end; ++it) { |
+ count += (*it)->stats().totalObjectSpace(); |
+ } |
+ return count; |
+} |
+ |
void Heap::getStats(HeapStats* stats) |
{ |
stats->clear(); |