forked from OSchip/llvm-project
Provide a getrusage based implementation of GetTotalMemoryUsage and use
the ru_maxrss field as an approximation. llvm-svn: 19072
This commit is contained in:
parent
1cf74cee21
commit
8005e66f0a
|
@ -74,6 +74,10 @@ Process::GetTotalMemoryUsage()
|
|||
#if defined(HAVE_MALLINFO)
|
||||
struct mallinfo mi = ::mallinfo();
|
||||
return mi.uordblks + mi.hblkhd;
|
||||
#elif defined(HAVE_GETRUSAGE)
|
||||
struct rusage usage;
|
||||
::getrusage(RUSAGE_SELF, &usage);
|
||||
return usage.ru_maxrss;
|
||||
#else
|
||||
#warning Cannot get total memory size on this platform
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue