mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 21:58:06 +00:00
Bug 664913: Add about:memory reporter for xptiWorkingSet. r=njn
This commit is contained in:
parent
5fedcf09b2
commit
58316a84d3
@ -41,9 +41,22 @@
|
||||
|
||||
#include "xptiprivate.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static PRInt64 GetXPTArenaSize(void*)
|
||||
{
|
||||
return XPT_SizeOfArena(gXPTIStructArena);
|
||||
}
|
||||
|
||||
NS_MEMORY_REPORTER_IMPLEMENT(xptiWorkingSet,
|
||||
"explicit/xpti-working-set",
|
||||
MR_HEAP,
|
||||
"Memory used by the XPCOM typelib system.",
|
||||
GetXPTArenaSize,
|
||||
nsnull)
|
||||
|
||||
#define XPTI_STRUCT_ARENA_BLOCK_SIZE (1024 * 1)
|
||||
#define XPTI_HASHTABLE_SIZE 2048
|
||||
|
||||
@ -57,6 +70,8 @@ xptiWorkingSet::xptiWorkingSet()
|
||||
|
||||
gXPTIStructArena = XPT_NewArena(XPTI_STRUCT_ARENA_BLOCK_SIZE, sizeof(double),
|
||||
"xptiWorkingSet structs");
|
||||
|
||||
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(xptiWorkingSet));
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
@ -82,6 +97,6 @@ xptiWorkingSet::~xptiWorkingSet()
|
||||
#ifdef NS_FREE_PERMANENT_DATA
|
||||
XPT_DestroyArena(gXPTIStructArena);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
XPTArena* gXPTIStructArena;
|
||||
|
@ -82,6 +82,9 @@ XPT_NotifyDoneLoading(XPTArena *arena);
|
||||
XPT_PUBLIC_API(void)
|
||||
XPT_ArenaFree(XPTArena *arena, void* block);
|
||||
|
||||
XPT_PUBLIC_API(size_t)
|
||||
XPT_SizeOfArena(XPTArena *arena);
|
||||
|
||||
/* --------------------------------------------------------- */
|
||||
|
||||
#define XPT_MALLOC(_arena, _bytes) \
|
||||
|
@ -336,3 +336,21 @@ XPT_AssertFailed(const char *s, const char *file, PRUint32 lineno)
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
XPT_PUBLIC_API(size_t)
|
||||
XPT_SizeOfArena(XPTArena *arena)
|
||||
{
|
||||
size_t n = sizeof(XPTArena);
|
||||
|
||||
BLK_HDR* cur;
|
||||
BLK_HDR* next;
|
||||
|
||||
cur = arena->first;
|
||||
while (cur) {
|
||||
next = cur->next;
|
||||
n += cur->size;
|
||||
cur = next;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user