Title: [129734] trunk/Source/WebCore
- Revision
- 129734
- Author
- [email protected]
- Date
- 2012-09-27 00:57:49 -0700 (Thu, 27 Sep 2012)
Log Message
Web Inspector: expose debug memory instrumentation debug data through the protocol
https://bugs.webkit.org/show_bug.cgi?id=97683
Reviewed by Pavel Feldman.
Memory.getProcessMemoryDistribution command now returns number of instrumented
objects that were found and the number of the objects that were counted by
the instrumentation but were not actually allocated by the memory allocator.
These numbers are only added to the response if embedder provides access to the
set of all live heap objects. These numbers are intended to be used for testing
memory instrumentation.
* inspector/InspectorMemoryAgent.cpp:
(WebCore::collectDomTreeInfo):
* inspector/MemoryInstrumentationImpl.cpp:
(WebCore::MemoryInstrumentationImpl::MemoryInstrumentationImpl):
(WebCore::MemoryInstrumentationImpl::checkCountedObject):
* inspector/MemoryInstrumentationImpl.h:
(WebCore::MemoryInstrumentationImpl::checkInstrumentedObjects):
(WebCore::MemoryInstrumentationImpl::totalCountedObjects):
(WebCore::MemoryInstrumentationImpl::totalObjectsNotInAllocatedSet):
(MemoryInstrumentationImpl):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (129733 => 129734)
--- trunk/Source/WebCore/ChangeLog 2012-09-27 07:53:07 UTC (rev 129733)
+++ trunk/Source/WebCore/ChangeLog 2012-09-27 07:57:49 UTC (rev 129734)
@@ -1,3 +1,28 @@
+2012-09-27 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: expose debug memory instrumentation debug data through the protocol
+ https://bugs.webkit.org/show_bug.cgi?id=97683
+
+ Reviewed by Pavel Feldman.
+
+ Memory.getProcessMemoryDistribution command now returns number of instrumented
+ objects that were found and the number of the objects that were counted by
+ the instrumentation but were not actually allocated by the memory allocator.
+ These numbers are only added to the response if embedder provides access to the
+ set of all live heap objects. These numbers are intended to be used for testing
+ memory instrumentation.
+
+ * inspector/InspectorMemoryAgent.cpp:
+ (WebCore::collectDomTreeInfo):
+ * inspector/MemoryInstrumentationImpl.cpp:
+ (WebCore::MemoryInstrumentationImpl::MemoryInstrumentationImpl):
+ (WebCore::MemoryInstrumentationImpl::checkCountedObject):
+ * inspector/MemoryInstrumentationImpl.h:
+ (WebCore::MemoryInstrumentationImpl::checkInstrumentedObjects):
+ (WebCore::MemoryInstrumentationImpl::totalCountedObjects):
+ (WebCore::MemoryInstrumentationImpl::totalObjectsNotInAllocatedSet):
+ (MemoryInstrumentationImpl):
+
2012-09-27 Mihnea Ovidenie <[email protected]>
[CSSRegions]Refactor RenderFlowThread::contentLogical(Width/Height/Left)OfFirstRegion
Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (129733 => 129734)
--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-09-27 07:53:07 UTC (rev 129733)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-09-27 07:57:49 UTC (rev 129734)
@@ -542,6 +542,20 @@
}
+static void addMemoryInstrumentationDebugData(TypeBuilder::Array<InspectorMemoryBlock>* children, const MemoryInstrumentationImpl& memoryInstrumentation)
+{
+ if (memoryInstrumentation.checkInstrumentedObjects()) {
+ RefPtr<InspectorMemoryBlock> totalInstrumented = InspectorMemoryBlock::create().setName("InstrumentedObjectsCount");
+ totalInstrumented->setSize(memoryInstrumentation.totalCountedObjects());
+
+ RefPtr<InspectorMemoryBlock> incorrectlyInstrumented = InspectorMemoryBlock::create().setName("InstrumentedButNotAllocatedObjectsCount");
+ incorrectlyInstrumented->setSize(memoryInstrumentation.totalObjectsNotInAllocatedSet());
+
+ children->addItem(totalInstrumented);
+ children->addItem(incorrectlyInstrumented);
+ }
+}
+
static void collectDomTreeInfo(Page* page, InspectorClient* inspectorClient, VisitedObjects& visitedObjects, TypeBuilder::Array<InspectorMemoryBlock>* children, InspectorDataCounter* inspectorData)
{
HashSet<const void*> allocatedObjects;
@@ -570,6 +584,7 @@
domTreesIterator.visitMemoryCache();
domTreesIterator.dumpStatistics(children, inspectorData);
+ addMemoryInstrumentationDebugData(children, memoryInstrumentation);
}
static void addPlatformComponentsInfo(PassRefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children)
Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp (129733 => 129734)
--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp 2012-09-27 07:53:07 UTC (rev 129733)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp 2012-09-27 07:57:49 UTC (rev 129734)
@@ -37,11 +37,11 @@
namespace WebCore {
-MemoryInstrumentationImpl::MemoryInstrumentationImpl(VisitedObjects& visitedObjects, const VisitedObjects* allocatedObjects
- )
+MemoryInstrumentationImpl::MemoryInstrumentationImpl(VisitedObjects& visitedObjects, const VisitedObjects* allocatedObjects)
: m_visitedObjects(visitedObjects)
, m_allocatedObjects(allocatedObjects)
, m_totalCountedObjects(0)
+ , m_totalObjectsNotInAllocatedSet(0)
{
}
@@ -75,11 +75,14 @@
void MemoryInstrumentationImpl::checkCountedObject(const void* object)
{
- if (!m_allocatedObjects)
+ if (!checkInstrumentedObjects())
return;
if (!m_allocatedObjects->contains(object)) {
- printf("Found unknwown object referenced byPointer: %p\n", object);
+ ++m_totalObjectsNotInAllocatedSet;
+#if 0
+ printf("Found unknown object referenced by pointer: %p\n", object);
WTFReportBacktrace();
+#endif
}
}
Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h (129733 => 129734)
--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h 2012-09-27 07:53:07 UTC (rev 129733)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h 2012-09-27 07:57:49 UTC (rev 129734)
@@ -63,6 +63,10 @@
return size;
}
+ bool checkInstrumentedObjects() const { return m_allocatedObjects; }
+ size_t totalCountedObjects() const { return m_totalCountedObjects; }
+ size_t totalObjectsNotInAllocatedSet() const { return m_totalObjectsNotInAllocatedSet; }
+
private:
virtual void countObjectSize(MemoryObjectType, size_t) OVERRIDE;
virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) OVERRIDE;
@@ -76,6 +80,7 @@
Vector<OwnPtr<InstrumentedPointerBase> > m_deferredInstrumentedPointers;
const VisitedObjects* m_allocatedObjects;
size_t m_totalCountedObjects;
+ size_t m_totalObjectsNotInAllocatedSet;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes