diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-12-20 16:33:37 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-12-20 16:33:37 +0000 |
commit | ed5e7bf422d6b908eb2f5bb55c3340d0e16f8efe (patch) | |
tree | d1abab22bd643c9262e8d2acacefdbe6f36448af /lib/System/Unix/Process.inc | |
parent | bc1ee840019978883dcfa87c301675d257cee9ed (diff) |
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
Diffstat (limited to 'lib/System/Unix/Process.inc')
-rw-r--r-- | lib/System/Unix/Process.inc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/System/Unix/Process.inc b/lib/System/Unix/Process.inc index c9507cb4e7..eef6535ee9 100644 --- a/lib/System/Unix/Process.inc +++ b/lib/System/Unix/Process.inc @@ -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; |