Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Necessary Changes to Deploy MemPerf on Android Platforms #7

Open
zhoujinzhoujin opened this issue Feb 26, 2022 · 0 comments
Open

Necessary Changes to Deploy MemPerf on Android Platforms #7

zhoujinzhoujin opened this issue Feb 26, 2022 · 0 comments

Comments

@zhoujinzhoujin
Copy link
Contributor

Based on my investigation, MemPerf can run on Android platforms after some code modifications.
First, the rdtscp() implementation should be changed. Answers in https://stackoverflow.com/questions/40454157/is-there-an-equivalent-instructionto-rdtsc-in-arm/40455065 provide some solution ideas.
Second, the dlsym() function to help intercept malloc, free, pthread_create, locks, and system calls also works on Android. However, there are public and private .so files in android, and dlsym() can only read symbols from public libraries. The interception part will work fine if the related libraries are public, or using alternative ways (like binary instrumentation)
Third, Android also has perf_event_open() function to utilize PMU. The work https://android.googlesource.com/platform/prebuilts/simpleperf/+/refs/heads/ndk-r13-release/README.md is very similar to perf, and it is for Android platforms. It supports both "perf stat" (PMU counting) and "perf record" (PMU sampling) commands.
Fourth, Android does not support backtrace() function, so it should be replaced with alternative implementations. https://stackoverflow.com/questions/8115192/android-ndk-getting-the-backtrace shows some solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant