summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtil.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerUtil.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp
index 81462a456e1..1d51cf91224 100644
--- a/llvm/lib/Fuzzer/FuzzerUtil.cpp
+++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp
@@ -12,6 +12,7 @@
#include "FuzzerInternal.h"
#include <sstream>
#include <iomanip>
+#include <sys/resource.h>
#include <sys/time.h>
#include <cassert>
#include <cstring>
@@ -217,4 +218,11 @@ std::string Base64(const Unit &U) {
return Res;
}
+size_t GetPeakRSSMb() {
+ struct rusage usage;
+ if (getrusage(RUSAGE_SELF, &usage))
+ return 0;
+ return usage.ru_maxrss >> 10;
+}
+
} // namespace fuzzer
OpenPOWER on IntegriCloud