Changeset 118847 in webkit


Ignore:
Timestamp:
May 29, 2012 3:59:15 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Add malloc info to about:memory page
https://bugs.webkit.org/show_bug.cgi?id=87676

Patch by Yong Li <yoli@rim.com> on 2012-05-29
Reviewed by Rob Buis.

Detailed malloc info can tell us how much memory
in the heaps is being in use.

  • WebCoreSupport/AboutData.cpp:

(WebCore::memoryPage):

Location:
trunk/Source/WebKit/blackberry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/ChangeLog

    r118805 r118847  
     12012-05-29  Yong Li  <yoli@rim.com>
     2
     3        [BlackBerry] Add malloc info to about:memory page
     4        https://bugs.webkit.org/show_bug.cgi?id=87676
     5
     6        Reviewed by Rob Buis.
     7
     8        Detailed malloc info can tell us how much memory
     9        in the heaps is being in use.
     10
     11        * WebCoreSupport/AboutData.cpp:
     12        (WebCore::memoryPage):
     13
    1142012-05-29  Arvid Nilsson  <anilsson@rim.com>
    215
  • trunk/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp

    r113672 r118847  
    2020#include "AboutData.h"
    2121
     22#include "CString.h"
    2223#include "MemoryCache.h"
    2324#include "SurfacePool.h"
    2425#include "WebKitVersion.h"
    2526
     27#include <process.h>
    2628#include <BlackBerryPlatformSettings.h>
     29#include <sys/stat.h>
    2730#include <sys/utsname.h>
    28 #include <wtf/Platform.h>
    2931
    3032namespace WebCore {
     
    196198    // generate cache information
    197199    MemoryCache* cacheInc = memoryCache();
    198     MemoryCache::Statistics stat = cacheInc->getStatistics();
     200    MemoryCache::Statistics cacheStat = cacheInc->getStatistics();
    199201
    200202    page += String("<h2>Cache Information</h2>")
     
    202204
    203205    MemoryCache::TypeStatistic total;
    204     total.count = stat.images.count + stat.cssStyleSheets.count
    205             + stat.scripts.count + stat.xslStyleSheets.count + stat.fonts.count;
     206    total.count = cacheStat.images.count + cacheStat.cssStyleSheets.count
     207            + cacheStat.scripts.count + cacheStat.xslStyleSheets.count + cacheStat.fonts.count;
    206208    total.size = cacheInc->totalSize();
    207     total.liveSize = stat.images.liveSize + stat.cssStyleSheets.liveSize
    208             + stat.scripts.liveSize + stat.xslStyleSheets.liveSize + stat.fonts.liveSize;
    209     total.decodedSize = stat.images.decodedSize
    210             + stat.cssStyleSheets.decodedSize + stat.scripts.decodedSize
    211             + stat.xslStyleSheets.decodedSize + stat.fonts.decodedSize;
     209    total.liveSize = cacheStat.images.liveSize + cacheStat.cssStyleSheets.liveSize
     210            + cacheStat.scripts.liveSize + cacheStat.xslStyleSheets.liveSize + cacheStat.fonts.liveSize;
     211    total.decodedSize = cacheStat.images.decodedSize
     212            + cacheStat.cssStyleSheets.decodedSize + cacheStat.scripts.decodedSize
     213            + cacheStat.xslStyleSheets.decodedSize + cacheStat.fonts.decodedSize;
    212214
    213215    page += cacheTypeStatisticToHTMLTr("Total", total);
    214     page += cacheTypeStatisticToHTMLTr("Images", stat.images);
    215     page += cacheTypeStatisticToHTMLTr("CSS Style Sheets", stat.cssStyleSheets);
    216     page += cacheTypeStatisticToHTMLTr("Scripts", stat.scripts);
     216    page += cacheTypeStatisticToHTMLTr("Images", cacheStat.images);
     217    page += cacheTypeStatisticToHTMLTr("CSS Style Sheets", cacheStat.cssStyleSheets);
     218    page += cacheTypeStatisticToHTMLTr("Scripts", cacheStat.scripts);
    217219#if ENABLE(XSLT)
    218     page += cacheTypeStatisticToHTMLTr("XSL Style Sheets", stat.xslStyleSheets);
    219 #endif
    220     page += cacheTypeStatisticToHTMLTr("Fonts", stat.fonts);
    221 
    222     page += "</table></body></html>";
     220    page += cacheTypeStatisticToHTMLTr("XSL Style Sheets", cacheStat.xslStyleSheets);
     221#endif
     222    page += cacheTypeStatisticToHTMLTr("Fonts", cacheStat.fonts);
     223
     224    page += "</table>";
     225
     226#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD
     227    struct mallinfo mallocInfo = mallinfo();
     228
     229    page += String("<h2>Malloc Information</h2>") + "<table align=\"center\" rules=\"all\">";
     230
     231    page += numberToHTMLTr("Total space in use", mallocInfo.usmblks + mallocInfo.uordblks);
     232    page += numberToHTMLTr("Total space in free blocks", mallocInfo.fsmblks + mallocInfo.fordblks);
     233    page += numberToHTMLTr("Size of the arena", mallocInfo.arena);
     234    page += numberToHTMLTr("Number of big blocks in use", mallocInfo.ordblks);
     235    page += numberToHTMLTr("Number of small blocks in use", mallocInfo.smblks);
     236    page += numberToHTMLTr("Number of header blocks in use", mallocInfo.hblks);
     237    page += numberToHTMLTr("Space in header block headers", mallocInfo.hblkhd);
     238    page += numberToHTMLTr("Space in small blocks in use", mallocInfo.usmblks);
     239    page += numberToHTMLTr("Memory in free small blocks", mallocInfo.fsmblks);
     240    page += numberToHTMLTr("Space in big blocks in use", mallocInfo.uordblks);
     241    page += numberToHTMLTr("Memory in free big blocks", mallocInfo.fordblks);
     242
     243    struct stat processInfo;
     244    if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo))
     245        page += numberToHTMLTr("Process total mapped memory", processInfo.st_size);
     246
     247    page += "</table>";
     248#endif
     249
     250    page += "</body></html>";
    223251    return page;
    224252}
Note: See TracChangeset for help on using the changeset viewer.