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 | 8005e66f0a0b5cbc0417afbbbced13d4fad4112e (patch) | |
tree | 61b0ef937566ab9485cc44ccc2f4a78d3134931b /llvm/lib/System/Unix/Process.cpp | |
parent | 1cf74cee2105efefc043ddb80051fe9f8db4b82f (diff) | |
download | bcm5719-llvm-8005e66f0a0b5cbc0417afbbbced13d4fad4112e.tar.gz bcm5719-llvm-8005e66f0a0b5cbc0417afbbbced13d4fad4112e.zip |
Provide a getrusage based implementation of GetTotalMemoryUsage and use
the ru_maxrss field as an approximation.
llvm-svn: 19072
Diffstat (limited to 'llvm/lib/System/Unix/Process.cpp')
-rw-r--r-- | llvm/lib/System/Unix/Process.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Process.cpp b/llvm/lib/System/Unix/Process.cpp index c9507cb4e7b..eef6535ee90 100644 --- a/llvm/lib/System/Unix/Process.cpp +++ b/llvm/lib/System/Unix/Process.cpp @@ -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; |