1.6 KiB
1.6 KiB
Profiling an Application on Android
How to profile a test application for Android
Set up Your Local Environment
- Download ADB SDK
- Add the SDK platform-tools to your PATH
- export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools"
Run the ADB profiler
The ADB profiler is a custom script which provides
- Battery statistics - battery.csv
- Memory statistics - memory.csv
- CPU statistics - cpu.json
python buildscripts/mobile/adb_monitor.py
Enable USB Debugging on Android Device
Enabling USB debugging can differ by device, see https://developer.android.com/studio/debug/dev-options
- Enable USB debugging via ADB, example
- Select Settings/About phone(or tablet)
- Select Build number 7 times, to enable Developer Options
- Select Settings/Developer Options/USB Debugging
- Connect the Android device to the computer via USB cable
- Select "Aways allow from this computer" and OK, when the prompt "Allow USB debugging?" appears on the device
Run the ADB Profiler Wirelessly
- Ensure the local computer and Android device are on the same network
- Connect the Android device to the computer via USB cable
- Set the Android device's ADB listening port
adb devicesadb tcpip 5555
- Disconnect the USB cable
- Identify the Android's IP address
- Settings/About phone(or tablet)/Status
adb_ip=<ip_address>, i.e., adb_ip=10.4.123.244
- Connect wirelessly to the Android device
adb connect $adb_ip
- Ensure you can connect to the Android device
adb shell uptime
- Run the ADB profiler as detailed above