RESOLVED FIXED 103232
Web Inspector: NMI introduce heap graph recording API
https://bugs.webkit.org/show_bug.cgi?id=103232
Summary Web Inspector: NMI introduce heap graph recording API
Ilya Tikhonovsky
Reported 2012-11-26 02:37:03 PST
Currently we have a plain memory usage statistic based on types. Unfortunately this 'type' to 'size' information couldn't help to web developers. They need an information about instances and owners. As example even about:blank page has ~5MB of Page.Image. This fact confuses the developers. Actually this image is a part of Inspector backend because it creates and uses a canvas in InspectorOverlay. After long offline discussion we came to the conclusion that we need to record a heap graph. We need to have 2 methods for that. reportNode and reportEdge. But due to c++ multiple inheritance we need a helper method reportAssociation which associates a pointer to parent class with pointer to descendant class. patch to follow.
Attachments
Patch (25.31 KB, patch)
2012-11-26 04:04 PST, Ilya Tikhonovsky
buildbot: commit-queue-
WIP (8.92 KB, patch)
2012-12-03 10:29 PST, Yury Semikhatsky
buildbot: commit-queue-
WIP (10.68 KB, patch)
2012-12-03 16:43 PST, Yury Semikhatsky
no flags
Patch (14.04 KB, patch)
2012-12-03 17:17 PST, Yury Semikhatsky
no flags
Patch (15.99 KB, patch)
2012-12-03 18:20 PST, Yury Semikhatsky
vsevik: review+
buildbot: commit-queue-
Ilya Tikhonovsky
Comment 1 2012-11-26 04:04:46 PST
Yury Semikhatsky
Comment 2 2012-11-26 04:27:34 PST
Comment on attachment 175966 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175966&action=review Let's split the patch into smaller parts. > Source/WTF/ChangeLog:8 > + reportNode, reportEdge and reportAssociation were added to the client API There is no reportAssociation. > Source/WTF/ChangeLog:10 > + InstrumentedPointerBase and InstrumentedPointer<T> wer renamed to PointerBase wer-> were > Source/WTF/ChangeLog:13 > + Pointer<T>::m_pointer was upstreamed to PointerBase because it needs to PointerBase::process method. it needs to PointerBase::process method -> PointerBase::process uses it
Build Bot
Comment 3 2012-11-26 04:31:48 PST
Build Bot
Comment 4 2012-11-26 04:51:27 PST
Yury Semikhatsky
Comment 5 2012-12-03 10:29:23 PST
Ilya Tikhonovsky
Comment 6 2012-12-03 10:38:43 PST
Comment on attachment 177282 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=177282&action=review > Source/WTF/wtf/MemoryInstrumentation.h:45 > +class String; unnecessary line > Source/WTF/wtf/MemoryInstrumentation.h:169 > + template<typename T> void addObjectImpl(const T* const&, MemoryObjectInfo*, MemoryOwningType, const char* name); I think it should be called edgeName.
Build Bot
Comment 7 2012-12-03 11:04:49 PST
Build Bot
Comment 8 2012-12-03 11:07:00 PST
Ilya Tikhonovsky
Comment 9 2012-12-03 12:14:41 PST
Comment on attachment 177282 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=177282&action=review > Source/WTF/wtf/MemoryInstrumentation.h:63 > + virtual void reportHeapObject(const MemoryObjectInfo&) { } I prefer reportNode method name. > Source/WTF/wtf/MemoryInstrumentation.h:64 > + virtual void reportEdge(const void* source, const void* target, const char* name) { } looks like we need a method for leafs: reportNodeLeaf which will be used for reporting private buffers with no pointer. it is required because we have no pointer and have to report the size together with edge.
Yury Semikhatsky
Comment 10 2012-12-03 16:43:08 PST
Yury Semikhatsky
Comment 11 2012-12-03 16:44:47 PST
(In reply to comment #9) > (From update of attachment 177282 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=177282&action=review > > > Source/WTF/wtf/MemoryInstrumentation.h:63 > > + virtual void reportHeapObject(const MemoryObjectInfo&) { } > > I prefer reportNode method name. > Done. > > Source/WTF/wtf/MemoryInstrumentation.h:64 > > + virtual void reportEdge(const void* source, const void* target, const char* name) { } > > looks like we need a method for leafs: reportNodeLeaf > which will be used for reporting private buffers with no pointer. > it is required because we have no pointer and have to report the size together with edge. Added reportLeaf for that.
Ilya Tikhonovsky
Comment 12 2012-12-03 16:49:37 PST
Comment on attachment 177371 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=177371&action=review > Source/WTF/wtf/MemoryInstrumentation.cpp:115 > + m_memoryInstrumentation->addRawBuffer(m_memoryObjectInfo->reportedPointer(), buffer, m_objectType, size); I think we need a node name argument here with default value 0 > Source/WTF/wtf/MemoryInstrumentation.cpp:125 > + m_memoryInstrumentation->reportLinkToBuffer(m_memoryObjectInfo->reportedPointer(), 0, ownerObjectType, size); ditto > Source/WTF/wtf/MemoryInstrumentation.h:45 > +class String; unnecessary forward declaration > Source/WTF/wtf/MemoryInstrumentation.h:146 > + template<typename T> void addObject(const T& t, MemoryObjectInfo* ownerObjectInfo, const char* name) { OwningTraits<T>::addObject(this, t, ownerObjectInfo, name); } name -> edgeName
Yury Semikhatsky
Comment 13 2012-12-03 17:17:58 PST
Yury Semikhatsky
Comment 14 2012-12-03 17:34:51 PST
(In reply to comment #12) > (From update of attachment 177371 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=177371&action=review > > > Source/WTF/wtf/MemoryInstrumentation.cpp:115 > > + m_memoryInstrumentation->addRawBuffer(m_memoryObjectInfo->reportedPointer(), buffer, m_objectType, size); > > I think we need a node name argument here with default value 0 > Done. > > Source/WTF/wtf/MemoryInstrumentation.cpp:125 > > + m_memoryInstrumentation->reportLinkToBuffer(m_memoryObjectInfo->reportedPointer(), 0, ownerObjectType, size); > > ditto > Done. > > Source/WTF/wtf/MemoryInstrumentation.h:45 > > +class String; > > unnecessary forward declaration > Done. > > Source/WTF/wtf/MemoryInstrumentation.h:146 > > + template<typename T> void addObject(const T& t, MemoryObjectInfo* ownerObjectInfo, const char* name) { OwningTraits<T>::addObject(this, t, ownerObjectInfo, name); } > > name -> edgeName Done.
Ilya Tikhonovsky
Comment 15 2012-12-03 17:54:10 PST
Comment on attachment 177380 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=177380&action=review > Source/WTF/wtf/MemoryInstrumentation.cpp:71 > + memoryObjectInfo.reportObjectInfo(buffer, ownerObjectType, size); What about assigning nodeName?
Build Bot
Comment 16 2012-12-03 17:57:39 PST
Ilya Tikhonovsky
Comment 17 2012-12-03 18:13:02 PST
Comment on attachment 177380 [details] Patch otherwise looks good
Yury Semikhatsky
Comment 18 2012-12-03 18:20:02 PST
Build Bot
Comment 19 2012-12-03 20:17:42 PST
Yury Semikhatsky
Comment 20 2012-12-04 14:03:15 PST
Note You need to log in before you can comment on or make changes to this bug.