[llvm-commits] CVS: llvm/lib/System/Unix/Process.cpp
Reid Spencer
reid at x10sys.com
Mon Dec 20 08:33:48 PST 2004
Changes in directory llvm/lib/System/Unix:
Process.cpp updated: 1.3 -> 1.4
---
Log message:
Provide a getrusage based implementation of GetTotalMemoryUsage and use
the ru_maxrss field as an approximation.
---
Diffs of the changes: (+4 -0)
Index: llvm/lib/System/Unix/Process.cpp
diff -u llvm/lib/System/Unix/Process.cpp:1.3 llvm/lib/System/Unix/Process.cpp:1.4
--- llvm/lib/System/Unix/Process.cpp:1.3 Mon Dec 20 10:06:44 2004
+++ llvm/lib/System/Unix/Process.cpp Mon Dec 20 10:33:37 2004
@@ -74,6 +74,10 @@
#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;
More information about the llvm-commits
mailing list