Bug 946781 - part 5 - measure the proto and iface cache from within xpconnect; r=bholley,njn

This commit is contained in:
Nathan Froyd 2013-12-06 13:08:45 -05:00
Родитель 4e5308cf32
Коммит ae1c027b6b
3 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -2728,6 +2728,10 @@ JSReporter::CollectReports(WindowPaths *windowPaths,
KIND_HEAP, sizeInfo.mScopeAndMapSize,
"Memory used by XPConnect scopes.");
REPORT_BYTES(NS_LITERAL_CSTRING("explicit/xpconnect/proto-iface-cache"),
KIND_HEAP, sizeInfo.mProtoAndIfaceCacheSize,
"Memory used for prototype and interface binding caches.");
REPORT_BYTES(NS_LITERAL_CSTRING("explicit/xpconnect/js-component-loader"),
KIND_HEAP, jsComponentLoaderSize,
"Memory used by XPConnect's JS component loader.");

Просмотреть файл

@ -679,6 +679,12 @@ XPCWrappedNativeScope::AddSizeOfIncludingThis(ScopeSizeInfo* scopeSizeInfo)
scopeSizeInfo->mScopeAndMapSize +=
mWrappedNativeProtoMap->SizeOfIncludingThis(scopeSizeInfo->mMallocSizeOf);
if (dom::HasProtoAndIfaceArray(mGlobalJSObject)) {
dom::ProtoAndIfaceArray* cache = dom::GetProtoAndIfaceArray(mGlobalJSObject);
scopeSizeInfo->mProtoAndIfaceCacheSize +=
cache->SizeOfIncludingThis(scopeSizeInfo->mMallocSizeOf);
}
// There are other XPCWrappedNativeScope members that could be measured;
// the above ones have been seen by DMD to be worth measuring. More stuff
// may be added later.

Просмотреть файл

@ -1139,10 +1139,14 @@ public:
struct ScopeSizeInfo {
ScopeSizeInfo(mozilla::MallocSizeOf mallocSizeOf)
: mMallocSizeOf(mallocSizeOf), mScopeAndMapSize(0) {}
: mMallocSizeOf(mallocSizeOf),
mScopeAndMapSize(0),
mProtoAndIfaceCacheSize(0)
{}
mozilla::MallocSizeOf mMallocSizeOf;
size_t mScopeAndMapSize;
size_t mProtoAndIfaceCacheSize;
};
static void