mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 945046 - Implement private and vsize-max-contiguous reporters on FreeBSD. r=njn, r=glandium
This commit is contained in:
parent
8458ddac1a
commit
6abc88d9b7
@ -1131,3 +1131,4 @@ unicode/unum.h
|
||||
unicode/ustring.h
|
||||
unicode/utypes.h
|
||||
#endif
|
||||
libutil.h
|
||||
|
@ -1131,3 +1131,4 @@ unicode/unum.h
|
||||
unicode/ustring.h
|
||||
unicode/utypes.h
|
||||
#endif
|
||||
libutil.h
|
||||
|
@ -289,6 +289,10 @@ OS_LIBS += $(call EXPAND_LIBNAME,kvm)
|
||||
EXTRA_DSO_LDOPTS += -Wl,--warn-unresolved-symbols
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),FreeBSD)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,util)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet wbemuuid)
|
||||
ifdef ACCESSIBILITY
|
||||
|
@ -204,6 +204,60 @@ ResidentFastDistinguishedAmount(int64_t* aN)
|
||||
return ResidentDistinguishedAmount(aN);
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <libutil.h>
|
||||
|
||||
static nsresult
|
||||
GetKinfoVmentrySelf(int64_t* prss, uint64_t* maxreg)
|
||||
{
|
||||
int cnt;
|
||||
struct kinfo_vmentry *vmmap, *kve;
|
||||
if ((vmmap = kinfo_getvmmap(getpid(), &cnt)) == NULL)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (prss)
|
||||
*prss = 0;
|
||||
if (maxreg)
|
||||
*maxreg = 0;
|
||||
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
kve = &vmmap[i];
|
||||
if (prss)
|
||||
*prss += kve->kve_private_resident;
|
||||
if (maxreg)
|
||||
*maxreg = std::max(*maxreg,
|
||||
kve->kve_end - kve->kve_start);
|
||||
}
|
||||
|
||||
free(vmmap);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define HAVE_PRIVATE_REPORTER
|
||||
static nsresult
|
||||
PrivateDistinguishedAmount(int64_t* aN)
|
||||
{
|
||||
int64_t priv;
|
||||
nsresult rv = GetKinfoVmentrySelf(&priv, NULL);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*aN = priv * getpagesize();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define HAVE_VSIZE_MAX_CONTIGUOUS_REPORTER 1
|
||||
static nsresult
|
||||
VsizeMaxContiguousDistinguishedAmount(int64_t* aN)
|
||||
{
|
||||
uint64_t biggestRegion;
|
||||
nsresult rv = GetKinfoVmentrySelf(NULL, &biggestRegion);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*aN = biggestRegion;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // FreeBSD
|
||||
|
||||
#elif defined(SOLARIS)
|
||||
|
||||
#include <procfs.h>
|
||||
|
Loading…
Reference in New Issue
Block a user