JavaScriptCore: Changed FastMalloc statistics reporting to be a bit clearer. We now
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Mar 2010 23:07:33 +0000 (23:07 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Mar 2010 23:07:33 +0000 (23:07 +0000)
report:
    - Reserved VM Bytes: the VM that has been mapped into the process.
    - Committed VM Bytes: the subset of Reserved VM Bytes actually in use.
    - Free List Bytes: the subset of Committed VM Bytes in a free list.

Reviewed by Darin Adler.

* wtf/FastMalloc.cpp:
(WTF::fastMallocStatistics):
(WTF::TCMallocStats::fastMallocStatistics): Updated to report the statistics
above. Standardized use of "ifdef WTF_CHANGES". Added a SpinLockHolder
around all statistics gathering, since it reads from the page heap.

* wtf/FastMalloc.h: Updated to report the statistics above.

WebKit/mac: Updated for FastMalloc reporting changes.

Reviewed by Darin Adler.

* Misc/WebCoreStatistics.mm:
(+[WebCoreStatistics memoryStatistics]):

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

JavaScriptCore/ChangeLog
JavaScriptCore/wtf/FastMalloc.cpp
JavaScriptCore/wtf/FastMalloc.h
WebKit/mac/ChangeLog
WebKit/mac/Misc/WebCoreStatistics.mm

index 927f217..011e632 100644 (file)
@@ -1,3 +1,21 @@
+2010-03-09  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Changed FastMalloc statistics reporting to be a bit clearer. We now
+        report:
+            - Reserved VM Bytes: the VM that has been mapped into the process.
+            - Committed VM Bytes: the subset of Reserved VM Bytes actually in use.
+            - Free List Bytes: the subset of Committed VM Bytes in a free list.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::fastMallocStatistics):
+        (WTF::TCMallocStats::fastMallocStatistics): Updated to report the statistics
+        above. Standardized use of "ifdef WTF_CHANGES". Added a SpinLockHolder
+        around all statistics gathering, since it reads from the page heap.
+
+        * wtf/FastMalloc.h: Updated to report the statistics above. 
+
 2010-03-09  Gabor Loki  <loki@webkit.org>
 
         Rubber-stamped by Maciej Stachowiak.
index a40a9b2..d1a4d28 100644 (file)
@@ -375,7 +375,7 @@ void releaseFastMallocFreeMemory() { }
     
 FastMallocStatistics fastMallocStatistics()
 {
-    FastMallocStatistics statistics = { 0, 0, 0, 0 };
+    FastMallocStatistics statistics = { 0, 0, 0 };
     return statistics;
 }
 
@@ -432,7 +432,7 @@ extern "C" const int jscore_fastmalloc_introspection = 0;
 #include <windows.h>
 #endif
 
-#if WTF_CHANGES
+#ifdef WTF_CHANGES
 
 #if OS(DARWIN)
 #include "MallocZoneSupport.h"
@@ -4431,7 +4431,7 @@ void FastMallocZone::init()
 
 #endif
 
-#if WTF_CHANGES
+#ifdef WTF_CHANGES
 void releaseFastMallocFreeMemory()
 {
     // Flush free pages in the current thread cache back to the page heap.
@@ -4449,20 +4449,21 @@ void releaseFastMallocFreeMemory()
 FastMallocStatistics fastMallocStatistics()
 {
     FastMallocStatistics statistics;
-    {
-        SpinLockHolder lockHolder(&pageheap_lock);
-        statistics.heapSize = static_cast<size_t>(pageheap->SystemBytes());
-        statistics.freeSizeInHeap = static_cast<size_t>(pageheap->FreeBytes());
-        statistics.returnedSize = pageheap->ReturnedBytes();
-        statistics.freeSizeInCaches = 0;
-        for (TCMalloc_ThreadCache* threadCache = thread_heaps; threadCache ; threadCache = threadCache->next_)
-            statistics.freeSizeInCaches += threadCache->Size();
-    }
+
+    SpinLockHolder lockHolder(&pageheap_lock);
+    statistics.reservedVMBytes = static_cast<size_t>(pageheap->SystemBytes());
+    statistics.committedVMBytes = statistics.reservedVMBytes - pageheap->ReturnedBytes();
+
+    statistics.freeListBytes = 0;
     for (unsigned cl = 0; cl < kNumClasses; ++cl) {
         const int length = central_cache[cl].length();
         const int tc_length = central_cache[cl].tc_length();
-        statistics.freeSizeInCaches += ByteSizeForClass(cl) * (length + tc_length);
+
+        statistics.freeListBytes += ByteSizeForClass(cl) * (length + tc_length);
     }
+    for (TCMalloc_ThreadCache* threadCache = thread_heaps; threadCache ; threadCache = threadCache->next_)
+        statistics.freeListBytes += threadCache->Size();
+
     return statistics;
 }
 
index 78ecb8d..ef98639 100644 (file)
@@ -83,10 +83,9 @@ namespace WTF {
     void releaseFastMallocFreeMemory();
     
     struct FastMallocStatistics {
-        size_t heapSize;
-        size_t freeSizeInHeap;
-        size_t freeSizeInCaches;
-        size_t returnedSize;
+        size_t reservedVMBytes;
+        size_t committedVMBytes;
+        size_t freeListBytes;
     };
     FastMallocStatistics fastMallocStatistics();
 
index b976a0c..3ff64d9 100644 (file)
@@ -1,3 +1,12 @@
+2010-03-09  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Updated for FastMalloc reporting changes.
+        
+        * Misc/WebCoreStatistics.mm:
+        (+[WebCoreStatistics memoryStatistics]):
+
 2010-03-08  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Mark Rowe.
index 9e8ae05..1351fe5 100644 (file)
@@ -196,10 +196,9 @@ using namespace WebCore;
     JSLock lock(SilenceAssertionsOnly);
     Heap::Statistics jsHeapStatistics = JSDOMWindow::commonJSGlobalData()->heap.statistics();
     return [NSDictionary dictionaryWithObjectsAndKeys:
-                [NSNumber numberWithInt:fastMallocStatistics.heapSize], @"FastMallocHeapSize",
-                [NSNumber numberWithInt:fastMallocStatistics.freeSizeInHeap], @"FastMallocFreeSizeInHeap",
-                [NSNumber numberWithInt:fastMallocStatistics.freeSizeInCaches], @"FastMallocFreeSizeInCaches",
-                [NSNumber numberWithInt:fastMallocStatistics.returnedSize], @"FastMallocReturnedSize",
+                [NSNumber numberWithInt:fastMallocStatistics.reservedVMBytes], @"FastMallocReservedVMBytes",
+                [NSNumber numberWithInt:fastMallocStatistics.committedVMBytes], @"FastMallocCommittedVMBytes",
+                [NSNumber numberWithInt:fastMallocStatistics.freeListBytes], @"FastMallocFreeListBytes",
                 [NSNumber numberWithInt:jsHeapStatistics.size], @"JavaScriptHeapSize",
                 [NSNumber numberWithInt:jsHeapStatistics.free], @"JavaScriptFreeSize",
             nil];