summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--simpleperf/environment.h6
-rw-r--r--simpleperf/perf_clock.cpp4
2 files changed, 10 insertions, 0 deletions
diff --git a/simpleperf/environment.h b/simpleperf/environment.h
index 7f8683de..8886e470 100644
--- a/simpleperf/environment.h
+++ b/simpleperf/environment.h
@@ -23,6 +23,7 @@
#if defined(__linux__)
#include <sys/syscall.h>
#include <unistd.h>
+#include <sys/prctl.h>
#endif
#include <functional>
@@ -35,6 +36,11 @@
#include "build_id.h"
#include "perf_regs.h"
+#if defined(__ANDROID__)
+ #define PR_SET_VMA 0x53564d41
+ #define PR_SET_VMA_ANON_NAME 0
+#endif
+
std::vector<int> GetOnlineCpus();
std::vector<int> GetCpusFromString(const std::string& s);
diff --git a/simpleperf/perf_clock.cpp b/simpleperf/perf_clock.cpp
index 127470e7..127fd21d 100644
--- a/simpleperf/perf_clock.cpp
+++ b/simpleperf/perf_clock.cpp
@@ -70,6 +70,10 @@ static void ThreadA(ThreadArg* thread_arg) {
}
array[i].end_system_time_in_ns = GetSystemClock();
+
+#if defined(__ANDROID__)
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, array[i].mmap_start_addr, 4096, "anony_map_region");
+#endif
}
size_t best_index = 0;
uint64_t min_duration_in_ns = UINT64_MAX;