Index: third_party/WebKit/Source/platform/heap/Heap.cpp |
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp |
index 6bcd260dbd920858993e47143f2f4882ba77f616..1b25eaf1ab2a3b339b19f36b246fb659b13363f1 100644 |
--- a/third_party/WebKit/Source/platform/heap/Heap.cpp |
+++ b/third_party/WebKit/Source/platform/heap/Heap.cpp |
@@ -30,6 +30,7 @@ |
#include "platform/heap/Heap.h" |
+#include "platform/Histogram.h" |
#include "platform/ScriptForbiddenScope.h" |
#include "platform/TraceEvent.h" |
#include "platform/heap/BlinkGCMemoryDumpProvider.h" |
@@ -111,7 +112,8 @@ public: |
double startTime = WTF::currentTimeMS(); |
bool allParked = gcType != BlinkGC::ThreadTerminationGC && ThreadState::stopThreads(); |
double timeForStoppingThreads = WTF::currentTimeMS() - startTime; |
- Platform::current()->histogramCustomCounts("BlinkGC.TimeForStoppingThreads", timeForStoppingThreads, 1, 1000, 50); |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, timeToStopThreadsHistogram, new CustomCountHistogram("BlinkGC.TimeForStoppingThreads", 1, 1000, 50)); |
+ timeToStopThreadsHistogram.count(timeForStoppingThreads); |
if (m_state->isMainThread()) |
TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(samplingState); |
@@ -452,9 +454,12 @@ void Heap::collectGarbage(BlinkGC::StackState stackState, BlinkGC::GCType gcType |
dataLogF("Heap::collectGarbage (gcReason=%s, lazySweeping=%d, time=%.1lfms)\n", gcReasonString(reason), gcType == BlinkGC::GCWithoutSweep, markingTimeInMilliseconds); |
#endif |
- Platform::current()->histogramCustomCounts("BlinkGC.CollectGarbage", markingTimeInMilliseconds, 0, 10 * 1000, 50); |
- Platform::current()->histogramCustomCounts("BlinkGC.TotalObjectSpace", Heap::allocatedObjectSize() / 1024, 0, 4 * 1024 * 1024, 50); |
- Platform::current()->histogramCustomCounts("BlinkGC.TotalAllocatedSpace", Heap::allocatedSpace() / 1024, 0, 4 * 1024 * 1024, 50); |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, markingTimeHistogram, new CustomCountHistogram("BlinkGC.CollectGarbage", 0, 10 * 1000, 50)); |
+ markingTimeHistogram.count(markingTimeInMilliseconds); |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalObjectSpaceHistogram, new CustomCountHistogram("BlinkGC.TotalObjectSpace", 0, 4 * 1024 * 1024, 50)); |
+ totalObjectSpaceHistogram.count(Heap::allocatedObjectSize() / 1024); |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalAllocatedSpaceHistogram, new CustomCountHistogram("BlinkGC.TotalAllocatedSpace", 0, 4 * 1024 * 1024, 50)); |
+ totalAllocatedSpaceHistogram.count(Heap::allocatedSpace() / 1024); |
Platform::current()->histogramEnumeration("BlinkGC.GCReason", reason, BlinkGC::NumberOfGCReason); |
Heap::reportMemoryUsageHistogram(); |
WTF::Partitions::reportMemoryUsageHistogram(); |
@@ -559,7 +564,8 @@ void Heap::globalWeakProcessing(Visitor* visitor) |
ASSERT(s_markingStack->isEmpty()); |
double timeForGlobalWeakProcessing = WTF::currentTimeMS() - startTime; |
- Platform::current()->histogramCustomCounts("BlinkGC.TimeForGlobalWeakPrcessing", timeForGlobalWeakProcessing, 1, 10 * 1000, 50); |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, globalWeakTimeHistogram, new CustomCountHistogram("BlinkGC.TimeForGlobalWeakPrcessing", 1, 10 * 1000, 50)); |
+ globalWeakTimeHistogram.count(timeForGlobalWeakProcessing); |
} |
void Heap::collectAllGarbage() |