Ignore:
Timestamp:
Nov 30, 2008, 2:19:42 PM (16 years ago)
Author:
Antti Koivisto
Message:

JavaScriptCore:

2008-11-30 Antti Koivisto <Antti Koivisto>

Reviewed by Mark Rowe.


https://bugs.webkit.org/show_bug.cgi?id=22557


Report free size in central and thread caches too.

  • wtf/FastMalloc.cpp: (WTF::TCMallocStats::fastMallocStatistics):
  • wtf/FastMalloc.h:

WebKit/mac:

2008-11-30 Antti Koivisto <Antti Koivisto>

Reviewed by Mark Rowe.


https://bugs.webkit.org/show_bug.cgi?id=22557


Report free size in central and thread caches too.

  • Misc/WebCoreStatistics.mm: (+[WebCoreStatistics memoryStatistics]):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r38848 r38853  
    236236FastMallocStatistics fastMallocStatistics()
    237237{
    238     FastMallocStatistics statistics;
    239     statistics.heapSize = 0;
    240     statistics.freeSize = 0;
    241     statistics.returnedSize = 0;
     238    FastMallocStatistics statistics = { 0, 0, 0, 0 };
    242239    return statistics;
    243240}
     
    38553852FastMallocStatistics fastMallocStatistics()
    38563853{
    3857     SpinLockHolder h(&pageheap_lock);
    3858 
    38593854    FastMallocStatistics statistics;
    3860     statistics.heapSize = static_cast<size_t>(pageheap->SystemBytes());
    3861     statistics.freeSize = static_cast<size_t>(pageheap->FreeBytes());
    3862     statistics.returnedSize = pageheap->ReturnedBytes();
     3855    {
     3856        SpinLockHolder lockHolder(&pageheap_lock);
     3857        statistics.heapSize = static_cast<size_t>(pageheap->SystemBytes());
     3858        statistics.freeSizeInHeap = static_cast<size_t>(pageheap->FreeBytes());
     3859        statistics.returnedSize = pageheap->ReturnedBytes();
     3860        statistics.freeSizeInCaches = 0;
     3861        for (TCMalloc_ThreadCache* threadCache = thread_heaps; threadCache ; threadCache = threadCache->next_)
     3862            statistics.freeSizeInCaches += threadCache->Size();
     3863    }
     3864    for (unsigned cl = 0; cl < kNumClasses; ++cl) {
     3865        const int length = central_cache[cl].length();
     3866        const int tc_length = central_cache[cl].tc_length();
     3867        statistics.freeSizeInCaches += ByteSizeForClass(cl) * (length + tc_length);
     3868    }
    38633869    return statistics;
    38643870}
Note: See TracChangeset for help on using the changeset viewer.