[llvm] r270173 - [LibFuzzer] Fix implementation of ``GetPeakRSSMb()`` on Mac OSX.
Dan Liew via llvm-commits
llvm-commits at lists.llvm.org
Thu May 19 18:37:56 PDT 2016
Author: delcypher
Date: Thu May 19 20:37:54 2016
New Revision: 270173
URL: http://llvm.org/viewvc/llvm-project?rev=270173&view=rev
Log:
[LibFuzzer] Fix implementation of ``GetPeakRSSMb()`` on Mac OSX.
On Linux ``rusage.ru_maxrss`` is in KiB but on Mac OSX it is in bytes.
Differential Revision: http://reviews.llvm.org/D20410
Modified:
llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp?rev=270173&r1=270172&r2=270173&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp Thu May 19 20:37:54 2016
@@ -288,7 +288,15 @@ size_t GetPeakRSSMb() {
struct rusage usage;
if (getrusage(RUSAGE_SELF, &usage))
return 0;
- return usage.ru_maxrss >> 10;
+ if (LIBFUZZER_LINUX) {
+ // ru_maxrss is in KiB
+ return usage.ru_maxrss >> 10;
+ } else if (LIBFUZZER_APPLE) {
+ // ru_maxrss is in bytes
+ return usage.ru_maxrss >> 20;
+ }
+ assert(0 && "GetPeakRSSMb() is not implemented for your platform");
+ return 0;
}
} // namespace fuzzer
More information about the llvm-commits
mailing list