Changeset 118357 in webkit
- Timestamp:
- May 24, 2012 6:01:53 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r118353 r118357 1 2012-05-23 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: add a command to InspectorMemoryAgent for getting process memory break down 4 https://bugs.webkit.org/show_bug.cgi?id=87263 5 6 Reviewed by Pavel Feldman. 7 8 Introduced new protocol command Memory.getProcessMemoryDistribution which returns 9 memory distribution for the inspected process. Currently only JS allocated and used 10 heap size is included. 11 12 * inspector/Inspector.json: 13 * inspector/InspectorMemoryAgent.cpp: 14 (WebCore::jsHeapInfo): 15 (WebCore): 16 (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution): 17 * inspector/InspectorMemoryAgent.h: 18 (InspectorMemoryAgent): 19 * platform/chromium/PlatformSupport.h: 20 (PlatformSupport): 21 1 22 2012-05-24 Nikolas Zimmermann <nzimmermann@rim.com> 2 23 -
trunk/Source/WebCore/inspector/Inspector.json
r118349 r118357 88 88 { "name": "listenerCount", "type": "array", "items": { "$ref": "ListenerCount" }} 89 89 ] 90 }, 91 { 92 "id": "MemoryBlock", 93 "type": "object", 94 "properties": [ 95 { "name": "size", "type": "integer", "optional":true, "description": "Size of the block in bytes if available" }, 96 { "name": "name", "type": "string", "description": "Unique name used to identify the component that allocated this block" }, 97 { "name": "children", "type": "array", "optional": true, "items": { "$ref": "MemoryBlock" }} 98 ] 90 99 } 91 100 ], … … 96 105 { "name": "domGroups", "type": "array", "items": { "$ref": "DOMGroup" }}, 97 106 { "name": "strings", "$ref": "StringStatistics" } 107 ] 108 }, 109 { 110 "name": "getProcessMemoryDistribution", 111 "returns": [ 112 { "name": "distribution", "$ref": "MemoryBlock", "description": "An object describing all memory allocated by the process"} 98 113 ] 99 114 } -
trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp
r113438 r118357 46 46 #include "Node.h" 47 47 #include "Page.h" 48 #if PLATFORM(CHROMIUM) 49 #include "PlatformSupport.h" 50 #endif 51 #include "ScriptGCEvent.h" 48 52 #include "ScriptProfiler.h" 49 53 #include "StyledElement.h" … … 53 57 using WebCore::TypeBuilder::Memory::DOMGroup; 54 58 using WebCore::TypeBuilder::Memory::ListenerCount; 59 using WebCore::TypeBuilder::Memory::MemoryBlock; 55 60 using WebCore::TypeBuilder::Memory::NodeCount; 56 61 using WebCore::TypeBuilder::Memory::StringStatistics; 57 62 58 63 namespace WebCore { 64 65 namespace MemoryBlockName { 66 static const char totalJsHeap[] = "TotalJSHeap"; 67 static const char processPrivateMemory[] = "ProcessPrivateMemory"; 68 static const char usedJsHeap[] = "UsedJSHeap"; 69 } 59 70 60 71 namespace { … … 308 319 } 309 320 321 static PassRefPtr<MemoryBlock> jsHeapInfo() 322 { 323 size_t usedJSHeapSize; 324 size_t totalJSHeapSize; 325 size_t jsHeapSizeLimit; 326 ScriptGCEvent::getHeapSize(usedJSHeapSize, totalJSHeapSize, jsHeapSizeLimit); 327 328 RefPtr<MemoryBlock> totalJsHeap = MemoryBlock::create().setName(MemoryBlockName::totalJsHeap); 329 totalJsHeap->setSize(totalJSHeapSize); 330 331 RefPtr<TypeBuilder::Array<MemoryBlock> > children = TypeBuilder::Array<MemoryBlock>::create(); 332 RefPtr<MemoryBlock> usedJsHeap = MemoryBlock::create().setName(MemoryBlockName::usedJsHeap); 333 usedJsHeap->setSize(usedJSHeapSize); 334 children->addItem(usedJsHeap); 335 336 totalJsHeap->setChildren(children); 337 return totalJsHeap.release(); 338 } 339 340 void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<MemoryBlock>& processMemory) 341 { 342 size_t privateBytes = 0; 343 #if PLATFORM(CHROMIUM) 344 size_t sharedBytes = 0; 345 PlatformSupport::getProcessMemorySize(&privateBytes, &sharedBytes); 346 #endif 347 processMemory = MemoryBlock::create().setName(MemoryBlockName::processPrivateMemory); 348 processMemory->setSize(privateBytes); 349 350 RefPtr<TypeBuilder::Array<MemoryBlock> > children = TypeBuilder::Array<MemoryBlock>::create(); 351 children->addItem(jsHeapInfo()); 352 processMemory->setChildren(children); 353 } 354 310 355 InspectorMemoryAgent::InspectorMemoryAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InspectorDOMAgent* domAgent) 311 356 : InspectorBaseAgent<InspectorMemoryAgent>("Memory", instrumentingAgents, state) -
trunk/Source/WebCore/inspector/InspectorMemoryAgent.h
r113157 r118357 57 57 return adoptPtr(new InspectorMemoryAgent(instrumentingAgents, state, page, domAgent)); 58 58 } 59 virtual ~InspectorMemoryAgent(); 59 60 60 void getDOMNodeCount(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Memory::DOMGroup> >& domGroups, RefPtr<TypeBuilder::Memory::StringStatistics>& strings); 61 virtual void getDOMNodeCount(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Memory::DOMGroup> >& domGroups, RefPtr<TypeBuilder::Memory::StringStatistics>& strings); 62 virtual void getProcessMemoryDistribution(ErrorString*, RefPtr<TypeBuilder::Memory::MemoryBlock>& processMemory); 61 63 62 ~InspectorMemoryAgent();63 64 64 65 private: -
trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp
r118351 r118357 57 57 } 58 58 59 // Must be kept in sync with TimelineAgent.js59 // Must be kept in sync with WebInspector.TimelineModel.RecordType in TimelineModel.js 60 60 namespace TimelineRecordType { 61 61 static const char EventDispatch[] = "EventDispatch"; -
trunk/Source/WebCore/platform/chromium/PlatformSupport.h
r118110 r118357 214 214 static void setSharedTimerFireInterval(double); 215 215 216 // Returns private and shared usage, in bytes. Private bytes is the amount of 217 // memory currently allocated to this process that cannot be shared. Returns 218 // false on platform specific error conditions. 219 static bool getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes); 216 220 // Theming ------------------------------------------------------------ 217 221 #if OS(WINDOWS) -
trunk/Source/WebKit/chromium/ChangeLog
r118352 r118357 1 2012-05-23 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: add a command to InspectorMemoryAgent for getting process memory break down 4 https://bugs.webkit.org/show_bug.cgi?id=87263 5 6 Reviewed by Pavel Feldman. 7 8 Added an API for retrieving render process private and shared memory in bytes. 9 10 * public/platform/WebKitPlatformSupport.h: 11 (WebKitPlatformSupport): 12 (WebKit::WebKitPlatformSupport::getProcessMemorySize): 13 * src/PlatformSupport.cpp: 14 (WebCore::PlatformSupport::getProcessMemorySize): 15 (WebCore): 16 1 17 2012-05-24 Hironori Bono <hbono@chromium.org> 2 18 -
trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
r118252 r118357 129 129 virtual WebSharedWorkerRepository* sharedWorkerRepository() { return 0; } 130 130 131 // Returns private and shared usage, in bytes. Private bytes is the amount of 132 // memory currently allocated to this process that cannot be shared. Returns 133 // false on platform specific error conditions. 134 virtual bool getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) { return false; } 131 135 132 136 protected: -
trunk/Source/WebKit/chromium/src/PlatformSupport.cpp
r118237 r118357 838 838 } 839 839 840 bool PlatformSupport::getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) 841 { 842 return webKitPlatformSupport()->getProcessMemorySize(privateBytes, sharedBytes); 843 } 844 840 845 int PlatformSupport::screenHorizontalDPI(Widget* widget) 841 846 {
Note: See TracChangeset
for help on using the changeset viewer.