Web Inspector: Add heap profiler owned memory to the pie chart
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2012 11:40:47 +0000 (11:40 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2012 11:40:47 +0000 (11:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89203

Heap profiler may consume considerable amount of memory
which is currently falls into Unknown category.
Give it a separate sector on the pie chart.

Patch by Alexei Filippov <alexeif@chromium.org> on 2012-06-18
Reviewed by Yury Semikhatsky.

* bindings/js/ScriptProfiler.h:
(WebCore::ScriptProfiler::profilerSnapshotsSize):
* bindings/v8/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::profilerSnapshotsSize):
(WebCore):
* bindings/v8/ScriptProfiler.h:
(ScriptProfiler):
* inspector/InspectorMemoryAgent.cpp:
(MemoryBlockName):
(WebCore):
(WebCore::inspectorData):
(WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.MemoryBlockViewProperties._initialize):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120589 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/js/ScriptProfiler.h
Source/WebCore/bindings/v8/ScriptProfiler.cpp
Source/WebCore/bindings/v8/ScriptProfiler.h
Source/WebCore/inspector/InspectorMemoryAgent.cpp
Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js

index 79c7bf3..a646202 100644 (file)
@@ -1,3 +1,29 @@
+2012-06-18  Alexei Filippov  <alexeif@chromium.org>
+
+        Web Inspector: Add heap profiler owned memory to the pie chart
+        https://bugs.webkit.org/show_bug.cgi?id=89203
+
+        Heap profiler may consume considerable amount of memory
+        which is currently falls into Unknown category.
+        Give it a separate sector on the pie chart.
+
+        Reviewed by Yury Semikhatsky.
+
+        * bindings/js/ScriptProfiler.h:
+        (WebCore::ScriptProfiler::profilerSnapshotsSize):
+        * bindings/v8/ScriptProfiler.cpp:
+        (WebCore::ScriptProfiler::profilerSnapshotsSize):
+        (WebCore):
+        * bindings/v8/ScriptProfiler.h:
+        (ScriptProfiler):
+        * inspector/InspectorMemoryAgent.cpp:
+        (MemoryBlockName):
+        (WebCore):
+        (WebCore::inspectorData):
+        (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
+        * inspector/front-end/NativeMemorySnapshotView.js:
+        (WebInspector.MemoryBlockViewProperties._initialize):
+
 2012-06-18  Mario Sanchez Prada  <msanchez@igalia.com>
 
         [GTK] Get rid of DumpRenderTreeSupportGtk::{in|de}crementAccessibilityValue
index ce4468e..8bb5601 100644 (file)
@@ -74,6 +74,7 @@ public:
     // FIXME: Implement this counter for JSC. See bug 73936 for more details.
     static void visitJSDOMWrappers(DOMWrapperVisitor*) { }
     static void visitExternalJSStrings(DOMWrapperVisitor*) { }
+    static size_t profilerSnapshotsSize() { return 0; }
 };
 
 } // namespace WebCore
index f2feb92..cdcdff1 100644 (file)
@@ -196,6 +196,11 @@ void ScriptProfiler::visitExternalJSStrings(DOMWrapperVisitor* visitor)
     V8BindingPerIsolateData::current()->visitJSExternalStrings(visitor);
 }
 
+size_t ScriptProfiler::profilerSnapshotsSize()
+{
+    return v8::HeapProfiler::GetMemorySizeUsedByProfiler();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 87e926f..6bd31a2 100644 (file)
@@ -78,6 +78,7 @@ public:
     static void initialize();
     static void visitJSDOMWrappers(DOMWrapperVisitor*);
     static void visitExternalJSStrings(DOMWrapperVisitor*);
+    static size_t profilerSnapshotsSize();
 };
 
 } // namespace WebCore
index e5651e3..752f728 100644 (file)
@@ -66,6 +66,7 @@ namespace WebCore {
 namespace MemoryBlockName {
 static const char jsHeapAllocated[] = "JSHeapAllocated";
 static const char jsHeapUsed[] = "JSHeapUsed";
+static const char inspectorData[] = "InspectorData";
 static const char memoryCache[] = "MemoryCache";
 static const char processPrivateMemory[] = "ProcessPrivateMemory";
 
@@ -347,6 +348,14 @@ static PassRefPtr<InspectorMemoryBlock> jsHeapInfo()
     return jsHeapAllocated.release();
 }
 
+static PassRefPtr<InspectorMemoryBlock> inspectorData()
+{
+    size_t dataSize = ScriptProfiler::profilerSnapshotsSize();
+    RefPtr<InspectorMemoryBlock> inspectorData = InspectorMemoryBlock::create().setName(MemoryBlockName::inspectorData);
+    inspectorData->setSize(static_cast<int>(dataSize));
+    return inspectorData.release();
+}
+
 static PassRefPtr<InspectorMemoryBlock> renderTreeInfo(Page* page)
 {
     ArenaSize arenaSize = page->renderTreeSize();
@@ -401,6 +410,7 @@ void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<Ins
 
     RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create();
     children->addItem(jsHeapInfo());
+    children->addItem(inspectorData());
     children->addItem(memoryCacheInfo());
     children->addItem(renderTreeInfo(m_page)); // TODO: collect for all pages?
     processMemory->setChildren(children);
index 09ecc58..cba6546 100644 (file)
@@ -214,13 +214,14 @@ WebInspector.MemoryBlockViewProperties._initialize = function()
     {
         WebInspector.MemoryBlockViewProperties._standardBlocks[name] = new WebInspector.MemoryBlockViewProperties(fillStyle, name, WebInspector.UIString(description));
     }
-    addBlock("rgba(255, 255, 255, 0.8)", "ProcessPrivateMemory", "Total");
-    addBlock("rgba(240, 240, 250, 0.8)", "Other", "Other");
-    addBlock("rgba(250, 200, 200, 0.8)", "JSHeapAllocated", "JavaScript heap");
-    addBlock("rgba(200, 250, 200, 0.8)", "JSHeapUsed", "Used JavaScript heap");
-    addBlock("rgba(200, 170, 200, 0.8)", "MemoryCache", "Memory cache resources");
-    addBlock("rgba(250, 250, 150, 0.8)", "RenderTreeAllocated", "Render tree");
-    addBlock("rgba(200, 150, 150, 0.8)", "RenderTreeUsed", "Render tree used");
+    addBlock("hsl(  0,  0%, 100%)", "ProcessPrivateMemory", "Total");
+    addBlock("hsl(  0,  0%,  80%)", "Other", "Other");
+    addBlock("hsl( 90, 60%,  80%)", "JSHeapAllocated", "JavaScript heap");
+    addBlock("hsl( 90, 80%,  80%)", "JSHeapUsed", "Used JavaScript heap");
+    addBlock("hsl(210, 60%,  80%)", "InspectorData", "Inspector data");
+    addBlock("hsl( 30, 60%,  80%)", "MemoryCache", "Memory cache resources");
+    addBlock("hsl( 60, 60%,  80%)", "RenderTreeAllocated", "Render tree");
+    addBlock("hsl( 60, 60%,  80%)", "RenderTreeUsed", "Render tree used");
 }
 
 WebInspector.MemoryBlockViewProperties._forMemoryBlock = function(memoryBlock)