Tuesday 3 February 2015

Very Useful ADB coomand for Debugging System and Android Application:

To show information about the currently running processes:
> adb shell ps


To display top CPU processes:
> adb shell top –m [num] –s [cpu | vss | rss | thr] –t –d [num]
-m [num]: Maximum number of processes to display
-s [cpu,vss,rss,thr]: column to sort by <cpu,vss,rss,thr>
-t: Show threads instead of processes
-d: Time interval for information update


To show memory usage:
> adb shell cat /proc/meminfo

*cat: To concatenate files and print on the standard
       output


To show a quick summary of process memory utilization. By default it shows Vss, Rss, Pss and Uss, and by sorts by Vss:
> adb shell procrank -p


To show a quick summary of process memory utilization. By default it shows Vss, Rss, Pss and Uss, and by sorts by Vss:
> adb shell procmem –p [PID]


To show memory information in details for the selected process
> adb shell dumpsys meminfo [PID]



logcat: Collect and view system debug output

      > adb shell logcat
      > adb logcat (ex. adb logcat –v time)

bugreport: Print dumpsys, dumpstate, and logcat data to the screen for the purposes of bug reporting. Same as log information by *#9900#

      > adb bugreport

pm: Package Manager. To perform actions and queries on application packages installed on the device.

      - List permission / instrumentation (all test packages) / feature (all features of the system)
      - Install / Remove package
      > adb shell pm <command> (ex. adb shell pm uninstall com.example.MyApp)

am: Activity Manager. To perform various system actions such as start an activity, force-stop a process, broadcast an intent, modify the device screen properties, and more.

      > adb shell am <command> (ex. adb shell am start -a android.intent.action.VIEW)

monkey: A program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.


      > adb shell monkey [options] <event-count>
        (ex. adb shell monkey -p your.package.name –v 500)


To dump traffic on a network
> adb shell tcpdump

USB Charge Mode off
echo 1 > sys/class/power_supply/battery/batt_slate_mode

No comments:

Post a Comment