[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

llvm-svn: 325020
This commit is contained in:
Kostya Kortchinsky 2018-02-13 17:05:54 +00:00
parent f73ff612ca
commit 1ce4642ddc
1 changed files with 4 additions and 1 deletions

View File

@ -763,7 +763,10 @@ uptr internal_ftruncate(fd_t fd, uptr size) {
}
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; }