转载:http://www.it165.net/pro/html/201406/16404.html
如果你想查看所有进程的内存使用情况,可以使用命令procrank、dumpsys meminfo查看,当然也只可以过滤出某个进程如:dumpsys meminfo | grep -i phone
先来看下procrank
01.
sh-
4.2
# procrank
02.
PID Vss Rss Pss Uss cmdline
03.
1078
59840K 59708K 42125K 39344K com.csr.BTApp
04.
2683
59124K 59040K 37960K 33032K com.android.launcher
05.
1042
51572K 51488K 35686K 33604K android.process.acore
06.
782
32808K 32748K 16775K 14716K system_server
07.
667
20560K 17560K 12739K 8940K /system/bin/surfaceflinger
08.
851
30124K 30036K 12085K 7996K com.android.systemui
09.
2999
27680K 27596K 9929K 7040K com.baidu.input
10.
959
20764K 20676K 5522K 3788K com.android.phone
11.
3468
21892K 21800K 4591K 1920K com.apical.dreamthemetime
12.
982
19880K 19792K 4438K 2644K com.csr.csrservices
13.
668
19592K 19480K 3525K 1360K zygote
14.
670
2960K 2960K 2407K 2356K /system/bin/mediaserver
15.
663
1784K 1784K 1209K 1116K /system/bin/synergy_service
16.
756
3404K 1348K 1133K 1124K /usr/bin/gpsexe
17.
669
1468K 1468K 959K 928K /system/bin/drmserver
18.
675
692K 692K 692K 692K /bin/sh
19.
758
1060K 1060K 630K 604K /system/bin/audiotransfer
20.
3482
656K 652K 456K 444K procrank
21.
664
664K 664K 403K 392K /system/bin/netd
22.
658
584K 584K 331K 320K /system/bin/vold
23.
666
548K 548K 270K 256K /system/bin/rild
24.
671
416K 412K 212K 204K /system/bin/dbus-daemon
25.
673
336K 332K 170K 164K /system/bin/keystore
26.
1
164K 164K 144K 144K /init
27.
674
152K 152K 136K 136K /sbin/adbd
28.
662
312K 312K 112K 104K /system/bin/dvdd
29.
672
328K 324K 109K 100K /system/bin/installd
30.
657
268K 264K 102K 96K /system/bin/servicemanager
31.
649
84K 84K 84K 84K /sbin/ueventd
32.
665
260K 256K 83K 76K /system/bin/debuggerd
33.
------ ------ ------
34.
195031K 163724K TOTAL
35.
36.
RAM: 480380K total, 3624K free, 732K buffers, 299788K cached, 264844K shmem, 7632K slab
使用dumpsys meminfo查看内存信息
01.
sh-
4.2
# dumpsys meminfo
02.
Applications Memory Usage (kB):
03.
Uptime:
3353863
Realtime:
3353850
04.
05.
Total PSS by process:
06.
41743
kB: com.csr.BTApp (pid
1078
)
07.
36924
kB: com.android.launcher (pid
2683
)
08.
35452
kB: android.process.acore (pid
1042
)
09.
16094
kB: system (pid
782
)
10.
11609
kB: com.android.systemui (pid
851
)
11.
8564
kB: com.baidu.input (pid
2999
)
12.
5298
kB: com.android.phone (pid
959
)
13.
4443
kB: com.apical.dreamthemetime (pid
4448
)
14.
4203
kB: com.csr.csrservices (pid
982
)
15.
4130
kB: com.apical.apicalradio (pid
4518
)
16.
17.
Total PSS by OOM adjustment:
18.
16094
kB: System
19.
16094
kB: system (pid
782
)
20.
21110
kB: Persistent
21.
11609
kB: com.android.systemui (pid
851
)
22.
5298
kB: com.android.phone (pid
959
)
23.
4203
kB: com.csr.csrservices (pid
982
)
24.
36924
kB: Foreground
25.
36924
kB: com.android.launcher (pid
2683
)
26.
85759
kB: Perceptible
27.
41743
kB: com.csr.BTApp (pid
1078
)
28.
35452
kB: android.process.acore (pid
1042
)
29.
8564
kB: com.baidu.input (pid
2999
)
30.
4443
kB: A Services
31.
4443
kB: com.apical.dreamthemetime (pid
4448
)
32.
4130
kB: Background
33.
4130
kB: com.apical.apicalradio (pid
4518
)
34.
35.
Total PSS by category:
36.
56020
kB: Dalvik
37.
30214
kB: Other dev
38.
27716
kB: Native
39.
24504
kB: Cursor
40.
13198
kB: Unknown
41.
7723
kB: Other mmap
42.
6895
kB: .so mmap
43.
1232
kB: .apk mmap
44.
888
kB: .dex mmap
45.
36
kB: .ttf mmap
46.
34
kB: Ashmem
47.
0
kB: .jar mmap
48.
49.
Total PSS:
168460
kB
01.
sh-
4.2
# dumpsys meminfo com.android.launcher
02.
Applications Memory Usage (kB):
03.
Uptime:
4497753
Realtime:
4497741
04.
05.
** MEMINFO in pid
2683
[com.android.launcher] **
06.
Shared Private Heap Heap Heap
07.
Pss Dirty Dirty Size Alloc Free
08.
------ ------ ------ ------ ------ ------
09.
Native
2144
988
2040
8636
5124
1699
10.
Dalvik
9481
8292
8644
13639
13335
304
11.
Cursor
0
0
0
12.
Ashmem
2
4
0
13.
Other dev
4
20
0
14.
.so mmap
922
1892
292
15.
.jar mmap
0
0
0
16.
.apk mmap
90
0
0
17.
.ttf mmap
0
0
0
18.
.dex mmap
300
0
0
19.
Other mmap
1634
16
112
20.
Unknown
1830
580
1772
21.
TOTAL
16407
11792
12860
22275
18459
2003
22.
23.
Objects
24.
Views:
146
ViewRootImpl:
1
25.
AppContexts:
374
Activities:
1
26.
Assets:
4
AssetManagers:
4
27.
Local Binders:
13
Proxy Binders:
23
28.
Death Recipients:
1
29.
OpenSSL Sockets:
0
30.
31.
SQL
32.
heap:
59
MEMORY_USED:
59
33.
PAGECACHE_OVERFLOW:
1
MALLOC_SIZE:
46
34.
35.
DATABASES
36.
pgsz dbsz Lookaside(b) cache Dbname
37.
1
179
55
2
/
11
/
2
launcher.db
38.
39.
Asset Allocations
40.
zip:/system/app/Launcher2.apk:/resources.arsc: 340K
41.
zip:/system/app/MediaCenter.apk:/resources.arsc: 604K
1.
dumpsys [options]
2.
meminfo 显示内存信息
3.
cpuinfo 显示CPU信息
4.
account 显示accounts信息
5.
activity 显示所有的activities的信息
6.
window 显示键盘,窗口和它们的关系
7.
wifi 显示wifi信息