[compiler-rt] r325020 - [sanitizer] Implement GetRSS on Windows
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 09:05:54 PST 2018
Author: cryptoad
Date: Tue Feb 13 09:05:54 2018
New Revision: 325020
URL: http://llvm.org/viewvc/llvm-project?rev=325020&view=rev
Log:
[sanitizer] Implement GetRSS on Windows
Summary:
Pretty straightforward, returning the `WorkingSetSize` of a
`PROCESS_MEMORY_COUNTERS` structure. AFAIU, `GetProcessMemoryInfo` is in
`kernel32.lib` for Windows 7 and above. Support for earlier Windows versions
would require `psapi.lib`, but I don't think those are supported by ASan?
Reviewers: alekseyshl, rnk, vitalybuka
Reviewed By: vitalybuka
Subscribers: vitalybuka, kubamracek, delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D42822
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=325020&r1=325019&r2=325020&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Tue Feb 13 09:05:54 2018
@@ -763,7 +763,10 @@ uptr internal_ftruncate(fd_t fd, uptr si
}
uptr GetRSS() {
- return 0;
+ PROCESS_MEMORY_COUNTERS counters;
+ if (!GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters)))
+ return 0;
+ return counters.WorkingSetSize;
}
void *internal_start_thread(void (*func)(void *arg), void *arg) { return 0; }
More information about the llvm-commits
mailing list