Ps process command Daquan

  

In the adb shell terminal, enter ps, you can view all current process status of the phone, where the full name of ps is Process Status.
1. ps command parameters

  • -t Show all child threads in the process
  • -c Show CPU time spent by the process
  • -p Display process Priority, nice value, scheduling policy
  • -P Display process, usually bg (background process) or fg (foreground process)
  • -x Shows the user time and system time consumed by the process, Format: (u:0, s:0), unit: second (s).

    The above parameters can be freely combined according to needs, such as only need to view the current process thread:

    View all child processes and child threads in the process : `ps - t |  Grep`;

    View all common applications. Since android is a single user, the user of the normal process starts with u0, and google intends to develop android into more support. The user's name should be u1
    , u2_, etc., and the normal app's uid starts at 10000:
    `ps |  Grep ^u0`;2. ps result analysis

    For example, on my mobile phone output the following command: (20671 is a process pid)
    ps -P -p -x -c |  Grep -E "NAME|  20671 "

    Output Results:


    Result Analysis:
    Field
    Meaning
    Value
    USER Process Current user system PID Process ID 20671 PPID Parent Process ID 497 VSIZE Process Virtual Address Space Size 2085804B RSS Process is using physical memory size 60892B CPU CPU consumption 1 PRIO Process optimization level 20 NICE Nice value 0 RTPRI Real-time process priority 0 SCHED scheduling policy SCHED_OTHER (default policy) PCY process Bg WCHAN kernel address ffffffff PC current program pointer b17d3d30 - sleep state S NAME process name com.android.settings - user mode and kernel state time (unit s) u:130, s:12

    Note: WCHAN value is 0 The process is running; otherwise it represents the kernel address (sleep state).

  • Copyright © Windows knowledge All Rights Reserved