레이블이 adb인 게시물을 표시합니다. 모든 게시물 표시
레이블이 adb인 게시물을 표시합니다. 모든 게시물 표시

2012년 12월 9일 일요일

adb procrank command

Android에서 가장 정확한 memory usage infomation을 제공한다.

tnkim@tnkim-N53SV:~/git/drawingmemo$ adb shell procrank -h
Usage: procrank [ -W ] [ -v | -r | -p | -u | -h ]
    -v  Sort by VSS.
    -r  Sort by RSS.
    -p  Sort by PSS.
    -u  Sort by USS.
        (Default sort order is PSS.)
    -R  Reverse sort order (default is descending).
    -w  Display statistics for working set only.
    -W  Reset working set of all processes.
    -h  Display this help screen.

중요한 정보는 아래와 같다.
  • USS(Unique Set Size)
    • 프로세스만의 고유한 페이지 수. 즉, 공유되지 않은 프로세스의 private한 메모리 크기이다.
  • PSS(Proportional Set Size)
    • USS + (공유 페이지 / 공유하는 프로세스 수)
    • 즉, 프로세스 고유 메모리 사용량 + 하나의 프로세스가 차지하는 공유 메모리 비율
    • 예. 만약 A프로세스가 6MB 메모리를 사용하고 그 중 2MB가 그 프로세스의 고유 영역(USS)이라면, 나머지 4MB는 공유 메모리이다. 4MB의 공유메모리를 4개의 프로세스가 공유하고 있다면 PSS는 2MB + (4MB/4) = 3MB가 된다.
    • 프로세스별 PSS 수치는 adb shell dumpsys meminfo <processname> 을 통해서도 볼 수 있다.
### start of procrank command example ###
tnkim@tnkim-N53SV:~/git/drawingmemo$ adb shell procrank
  PID      Vss            Rss         Pss          Uss        cmdline
 1296   49828K   47396K   18075K   15048K  system_server
 1357   46140K   39876K   11308K    9244K  com.android.systemui
 2951   41388K   38260K    9937K    7892K  com.android.gallery3d
 4174   34972K   34880K    8019K    6400K  android.process.acore
 1186   36564K   36440K    6267K    3468K  zygote
 1525   32160K   32108K    5957K    4676K  com.android.phone
 1492   31620K   31532K    5460K    4248K  android.process.media
 4246   29156K   29060K    3758K    2536K  com.android.quicksearchbox
 4191   29152K   29080K    3600K    2476K  com.android.keychain
 4158   28684K   28616K    3442K    2372K  com.android.defcontainer
 1188    6896K    6896K    2756K    2400K  /system/bin/mediaserver
...
 4991     116K     116K      67K      64K  /sbin/adbd
 8279     124K     124K      63K      56K  /sbin/adbd
 8006     120K     120K      63K      56K  /sbin/adbd
                          ------   ------  ------
                         280030K  239196K  TOTAL

RAM: 868796K total, 275900K free, 27536K buffers, 194924K cached, 1136K shmem, 14140K slab
### end of procrank command example ###

* 참고 사이트

2012년 11월 8일 목요일

adb top command

시스템 프로세스 상황 모니터링/ 프로세스별 CPU사용량, 메모리와 스왑 사용량 등
top is a command to monitor usage of cpu, memory and swap each system process


Usage: top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ]
    -m num  Maximum number of processes to display.
    -n num  Updates to show before exiting.
    -d num  Seconds to wait between updates.
    -s col  Column to sort by (cpu,vss,rss,thr).
    -t      Show threads instead of processes.
    -h      Display this help screen.


*** THE START OF EXAMPLE ***
tnkim@tnkim-N53SV:~$ adb shell top -m 10

User 2%, System 2%, IOW 0%, IRQ 0%
User 17 + Nice 0 + Sys 16 + Idle 571 + IOW 1 + IRQ 0 + SIRQ 0 = 605

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
 8057  1   2% R     1    988K    392K  fg shell    top
 1275  0   0% S    65 352552K  45472K  fg system   system_server
  306  0   0% S     1      0K      0K  fg root     spi1
 1643  1   0% S    17 290620K  34152K  bg app_31   tw.dmb.service
 5971  0   0% S     1      0K      0K  fg root     kworker/0:2
 1833  1   0% S     9 276952K  28092K  bg app_30   com.thinkware.timesignal
 2026  0   0% S     5   4476K    220K  fg shell    /sbin/adbd
 1527  0   0% S    25 307048K  44920K  fg app_20   com.thinkware.dixon.nip
 1179  1   0% S    16  44680K   5408K  fg system   /system/bin/surfaceflinger
 1813  1   0% S    14 282368K  28656K  bg app_28   tw.cardiaryplus.deamon



User 4%, System 3%, IOW 0%, IRQ 0%
User 26 + Nice 0 + Sys 21 + Idle 570 + IOW 0 + IRQ 0 + SIRQ 0 = 617

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
 8057  1   2% R     1    992K    404K  fg shell    top
 1275  0   1% S    65 352552K  45472K  fg system   system_server
  306  0   0% D     1      0K      0K  fg root     spi1
 1333  1   0% S    18 306988K  40020K  fg system   com.android.systemui
 1643  0   0% S    17 290620K  34152K  bg app_31   tw.dmb.service
  802  0   0% S     1      0K      0K  fg root     tpeg_thread
 5971  0   0% S     1      0K      0K  fg root     kworker/0:2
 1527  0   0% S    25 307048K  44920K  fg app_20   com.thinkware.dixon.nip
 2026  0   0% S     5   4476K    220K  fg shell    /sbin/adbd
 1179  1   0% S    16  44680K   5408K  fg system   /system/bin/surfaceflinger
...
*** THE END OF EXAMPLE ***