[PATCH] Sanitizers: Implement `GetRSS` on Mac OS X
Ismail Pazarbasi
ismail.pazarbasi at gmail.com
Sat May 9 08:01:46 PDT 2015
Hi kcc, glider, dvyukov,
http://reviews.llvm.org/D9636
Files:
lib/sanitizer_common/sanitizer_mac.cc
Index: lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- lib/sanitizer_common/sanitizer_mac.cc
+++ lib/sanitizer_common/sanitizer_mac.cc
@@ -44,6 +44,7 @@
#include <unistd.h>
#include <libkern/OSAtomic.h>
#include <errno.h>
+#include <mach/mach.h>
namespace __sanitizer {
@@ -333,7 +334,20 @@
}
uptr GetRSS() {
- return 0;
+ kern_return_t result;
+ unsigned count;
+ struct task_basic_info info;
+
+ count = TASK_BASIC_INFO_COUNT;
+ result =
+ task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &count);
+ if (UNLIKELY(result != KERN_SUCCESS)) {
+ Report("Could not get task info - RSS value will not be available. "
+ "Error: %d\n", result);
+ return 0U;
+ }
+
+ return info.resident_size;
}
void *internal_start_thread(void (*func)(void *arg), void *arg) { return 0; }
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9636.25407.patch
Type: text/x-patch
Size: 891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150509/5e4e21f4/attachment.bin>
More information about the llvm-commits
mailing list