DroidPerf is a lightweight, object-centric memory profiler for Android Runtime(ART), which associates memory inefficiencies with objects used by Android apps. With such object-level information, DroidPerf is able to guide locality optimization on memory layouts, access patterns, and allocation patterns.
- gcc (>= 4.8)
- cmake (>= 3.4)
- Android SDK (>= 33)
- Android NDK (>= 21)
Follow these steps to build and install DroidPerf:
- Clone this repository to your local machine.
- Run the shell script file build.sh to implement cross-compilation. The first argument is the path of the NDK, and the second argument is the architecture of the Android device. The command could be like:
sh build.sh ~/Library/Android/sdk/ndk/21.1.6352462 "arm64-v8a"
- Android device
- Root privileges of this device
To use DroidPerf, follow these steps:
- Connect your Android device to your computer using a USB cable.
- Install and run the application you want to profile on your Android device.
- Open a terminal or command prompt on your computer and navigate to the directory where libdroidperf.so is located.
- Run the following commands after modifying the variables:
adb push libdroidperf.so /sdcard/Download
adb shell
su
PATH_APP="PATH/OF/APPLICATION" # Path of the application like "/data/data/org.jak_linux.dns66"
PID_TARGET="PROCESS/ID/OF/APPLICATION" # Process ID of corresponding application
cp /sdcard/Download/libdroidperf.so $PATH_APP
rm -f /sdcard/Documents/*.run*
chmod 777 $PATH_APP/libdroidperf.so
cmd activity attach-agent $PID_TARGET $PATH_APP/libdroidperf.so=Generic::CYCLES:precise=2@100000000
DroidPerf is evaluated on a Google Pixel 7 with the Google Tensor G2 chipset. It has eight Octa-core cores and an Mali-G710 MP7 GPU, with 8 GB of LPDDR4X RAM and 128 GB of non-expandable UFS 3.1 internal storage. The cache hierarchy consists of 128 KB and 512 KB L1 and L2 caches and a 4 MB L3 cache.
DroidPerf is released under the MIT License.