- 参考http://blog.csdn.net/zhangjg_blog/article/details/39852309
- dumpsys命令是android手机自带的调试工具,下面详解讲解dumpsys用法
- 该命令打印出的是系统当前的所有正在运行的服务的信息。从中可以看到我们常见的一些服务。 activity表示的是ActivityManagerService,用于管理应用程序的四大组件, appops表示的是AppOpsManagerService, 用于管理和配置权限。window表示的是WindowManagerService, 用于管理系统中的窗口, account表示的是AccountManagerService,用于管理系统中的账户信息。
一. 初识dumpsys
adb shell //进入手机shell
dumpsys | grep "DUMP OF SERVICE" //列举当前手机所有支持的dumpsys命令
- 1
- 2
运行上面指令,结果(不同手机结果会有所差异)
DUMP OF SERVICE AppIconThemeServices:
DUMP OF SERVICE AtCmdFwd:
DUMP OF SERVICE DockObserver:
DUMP OF SERVICE SurfaceFlinger:
DUMP OF SERVICE accessibility:
DUMP OF SERVICE account:
DUMP OF SERVICE activity:
DUMP OF SERVICE alarm:
DUMP OF SERVICE android.security.keystore:
DUMP OF SERVICE appops:
DUMP OF SERVICE appwidget:
DUMP OF SERVICE assetatlas:
DUMP OF SERVICE audio:
DUMP OF SERVICE backup:
DUMP OF SERVICE battery:
DUMP OF SERVICE batteryproperties:
DUMP OF SERVICE batterystats:
DUMP OF SERVICE bluetooth_manager:
DUMP OF SERVICE clipboard:
DUMP OF SERVICE com.broadcom.nfc.Factory:
DUMP OF SERVICE com.qualcomm.qti.auth.fidocryptodaemon:
DUMP OF SERVICE commontime_management:
DUMP OF SERVICE connectivity:
DUMP OF SERVICE consumer_ir:
DUMP OF SERVICE content:
DUMP OF SERVICE country_detector:
DUMP OF SERVICE cpuinfo:
DUMP OF SERVICE dbinfo:
DUMP OF SERVICE device_policy:
DUMP OF SERVICE devicestoragemonitor:
DUMP OF SERVICE diskstats:
DUMP OF SERVICE display:
DUMP OF SERVICE display.qservice:
DUMP OF SERVICE dreams:
DUMP OF SERVICE drm.drmManager:
DUMP OF SERVICE dropbox:
DUMP OF SERVICE entropy:
DUMP OF SERVICE fingerprint:
DUMP OF SERVICE fm_fingerprint_service:
DUMP OF SERVICE gfxinfo:
DUMP OF SERVICE hardware:
DUMP OF SERVICE imms:
DUMP OF SERVICE ims:
DUMP OF SERVICE input:
DUMP OF SERVICE input_method:
DUMP OF SERVICE iphonesubinfo:
DUMP OF SERVICE isms:
DUMP OF SERVICE isub:
DUMP OF SERVICE jobscheduler:
DUMP OF SERVICE karaoke:
DUMP OF SERVICE launcherapps:
DUMP OF SERVICE lenovopermission:
DUMP OF SERVICE location:
DUMP OF SERVICE lock_settings:
DUMP OF SERVICE media.audio_flinger:
DUMP OF SERVICE media.audio_policy:
DUMP OF SERVICE media.camera:
DUMP OF SERVICE media.player:
DUMP OF SERVICE media.sound_trigger_hw:
DUMP OF SERVICE media_projection:
DUMP OF SERVICE media_router:
DUMP OF SERVICE media_session:
DUMP OF SERVICE meminfo:
DUMP OF SERVICE mount:
DUMP OF SERVICE netpolicy:
DUMP OF SERVICE netstats:
DUMP OF SERVICE network_management:
DUMP OF SERVICE network_score:
DUMP OF SERVICE nfc:
DUMP OF SERVICE notification:
DUMP OF SERVICE package:
rUMP OF SERVICE permission:
DUMP OF SERVICE phone:
DUMP OF SERVICE power:
DUMP OF SERVICE print:
DUMP OF SERVICE procstats:
DUMP OF SERVICE qti.ims.connectionmanagerservice:
DUMP OF SERVICE restrictions:
DUMP OF SERVICE rttmanager:
DUMP OF SERVICE samplingprofiler:
DUMP OF SERVICE scheduling_policy:
DUMP OF SERVICE search:
DUMP OF SERVICE sensorservice:
DUMP OF SERVICE serial:
DUMP OF SERVICE servicediscovery:
DUMP OF SERVICE simphonebook:
DUMP OF SERVICE sip:
DUMP OF SERVICE start_shutdown:
DUMP OF SERVICE statusbar:
DUMP OF SERVICE telecom:
DUMP OF SERVICE telephony.registry:
DUMP OF SERVICE textservices:
DUMP OF SERVICE trust:
DUMP OF SERVICE uimode:
DUMP OF SERVICE updatelock:
DUMP OF SERVICE usagestats:
DUMP OF SERVICE usb:
DUMP OF SERVICE user:
DUMP OF SERVICE vendor.qcom.PeripheralManager:
DUMP OF SERVICE vibrator:
DUMP OF SERVICE voiceinteraction:
DUMP OF SERVICE wallpaper:
DUMP OF SERVICE wbc_service:
DUMP OF SERVICE webviewupdate:
DUMP OF SERVICE wfdservice:
DUMP OF SERVICE wifi:
DUMP OF SERVICE wifip2p:
DUMP OF SERVICE wifiscanner:
DUMP OF SERVICE window:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
二. dumpsys用法
(1)前面输入每一行都是都可以组成一条dumpsys指令。例如:DUMP OF SERVICE meminfo
dumpsys meminfo //输出当前所有memory相关的信息
- 1
(2)当我们想查看具体某个应用的内存使用情况,例如QQ:
dumpsys meminfo com.tencent.mobileqq
- 1
运行结果:
Applications Memory Usage (kB):
Uptime: 7382804 Realtime: 7382804
** MEMINFO in pid 22590 [com.tencent.mobileqq] **
Pss Private Private Swapped Heap Heap Heap
Total Dirty Clean Dirty Size Alloc Free
------ ------ ------ ------ ------ ------ ------
Native Heap 8701 8416 0 0 16384 10626 5757
Dalvik Heap 10247 6548 0 0 37655 22685 14970
Dalvik Other 633 632 0 0
Stack 820 820 0 0
Gfx dev 68 68 0 0
Other dev 25 0 24 0
.so mmap 5365 164 3236 0
.apk mmap 564 0 360 0
.ttf mmap 378 0 60 0
.dex mmap 5690 0 4368 0
.oat mmap 2711 0 272 0
.art mmap 2825 1596 12 0
Other mmap 52 4 0 0
Unknown 151 140 0 0
TOTAL 38230 18388 8332 0 54039 33311 20727
Objects
Views: 8 ViewRootImpl: 1
AppContexts: 3 Activities: 1
Assets: 3 AssetManagers: 3
Local Binders: 23 Proxy Binders: 23
Parcel memory: 9 Parcel count: 39
Death Recipients: 2 OpenSSL Sockets: 0
SQL
MEMORY_USED: 0
PAGECACHE_OVERFLOW: 0 MALLOC_SIZE: 62
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
(3)帮助信息
dumpsys meminfo -h //此处以meminfo为例,其他指令也是类同
- 1
运行结果
meminfo dump options: [-a] [-d] [-c] [--oom] [process]
-a: include all available information for each process.
-d: include dalvik details when dumping process details.
-c: dump in a compact machine-parseable representation.
--oom: only show processes organized by oom adj.
--local: only collect details locally, don't call process.
--package: interpret process arg as package, dumping all
processes that have loaded that package.
If [process] is specified it can be the name or
pid of a specific process to dump.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
三. dumpsys常用指令
dumpsys指令很多, 下面列举一些常用的dumpsys指令的功能
dumpsys package <package_name> //查看指定包名的信息
dumpsys activity <package_name> //查看指定包名的activity信息
dumpsys alarm //查看Alarm信息
dumpsys audio //查看声音信息
dumpsys battery //查看电池信息
dumpsys cpuinfo //查看CPU信息
dumpsys meminfo <package_name>//查看指定包名的内存信息
dumpsys netstats//查看网络统计信息
dumpsys diskstats //查看空间free状态
dumpsys jobscheduler //查看任务计划
dumpsys power//查看功耗信息
dumpsys wifi//查看wifi信息