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

Unified Diff: Source/platform/heap/Heap.cpp

Issue 304673003: Add UMAs about Blink GC metrics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698