The script should assume that the application is already running on the device and shouldn't concern itself with how the application was started (i.e. it'll be the responsibility of some other part of this mobile testing framework which deals with that). The script should run continuously and collect the resource utilization at some configurable frequency until the it is signaled to exit. It should define functions like start() and stop() so that the script can also be used as a library and controlled programmatically.
- CPU consumption: python systrace.py
- Memory consumption: adb shell dumpsys meminfo
- Battery consumption: adb shell dumpsys batterystats