Add mallopt M_PURGE benchmark.

Update the native allocator documentation to include running of this
benchmark.

Move the malloc_benchmark.cpp to malloc_sql_benchmark.cpp and use
malloc_benchmark.cpp for benchmarking functions from malloc.h.

Bug: 137795072

Test: Ran new benchmark.
Change-Id: I76856de833032da324ad0bc0b6bd85a4ea8c253d
diff --git a/benchmarks/util.h b/benchmarks/util.h
index ef4892d..99eed5f 100644
--- a/benchmarks/util.h
+++ b/benchmarks/util.h
@@ -16,6 +16,8 @@
 
 #pragma once
 
+#include <stdint.h>
+
 #include <map>
 #include <mutex>
 #include <string>
@@ -68,3 +70,11 @@
 char* GetAlignedPtrFilled(std::vector<char>* buf, size_t alignment, size_t nbytes, char fill_byte);
 
 bool LockToCPU(int cpu_to_lock);
+
+static __inline __attribute__ ((__always_inline__)) void MakeAllocationResident(
+    void* ptr, size_t nbytes, int pagesize) {
+  uint8_t* data = reinterpret_cast<uint8_t*>(ptr);
+  for (size_t i = 0; i < nbytes; i += pagesize) {
+    data[i] = 1;
+  }
+}