mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-13 19:40:26 +00:00
Provide a getrusage based implementation of GetTotalMemoryUsage and use
the ru_maxrss field as an approximation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19072 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc1ee84001
commit
ed5e7bf422
@ -74,6 +74,10 @@ Process::GetTotalMemoryUsage()
|
|||||||
#if defined(HAVE_MALLINFO)
|
#if defined(HAVE_MALLINFO)
|
||||||
struct mallinfo mi = ::mallinfo();
|
struct mallinfo mi = ::mallinfo();
|
||||||
return mi.uordblks + mi.hblkhd;
|
return mi.uordblks + mi.hblkhd;
|
||||||
|
#elif defined(HAVE_GETRUSAGE)
|
||||||
|
struct rusage usage;
|
||||||
|
::getrusage(RUSAGE_SELF, &usage);
|
||||||
|
return usage.ru_maxrss;
|
||||||
#else
|
#else
|
||||||
#warning Cannot get total memory size on this platform
|
#warning Cannot get total memory size on this platform
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -74,6 +74,10 @@ Process::GetTotalMemoryUsage()
|
|||||||
#if defined(HAVE_MALLINFO)
|
#if defined(HAVE_MALLINFO)
|
||||||
struct mallinfo mi = ::mallinfo();
|
struct mallinfo mi = ::mallinfo();
|
||||||
return mi.uordblks + mi.hblkhd;
|
return mi.uordblks + mi.hblkhd;
|
||||||
|
#elif defined(HAVE_GETRUSAGE)
|
||||||
|
struct rusage usage;
|
||||||
|
::getrusage(RUSAGE_SELF, &usage);
|
||||||
|
return usage.ru_maxrss;
|
||||||
#else
|
#else
|
||||||
#warning Cannot get total memory size on this platform
|
#warning Cannot get total memory size on this platform
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user