必威体育Betway必威体育官网
当前位置:首页 > IT技术

dumpsys

时间:2019-07-21 01:10:00来源:IT技术作者:seo实验室小编阅读:73次「手机版」
 

dump

dumpsys命令是Android手机自带的调试工具,下面讲解dumpsys用法

Dumpsys用户系统诊断,它运行在设备上,并提供系统服务状态信息

命令格式: adb shell dumpsys [system serbices]

如果直接运行adb shell dumpsys,将会获得所有的系统服务信息,那是非常多的,为了更容易管理输出,可以指定你想要检查的服务,例如:

adb shell dumpsys –l

adb shell serverce list

#都是查看有哪些系统服务(需要哪些服务就指定哪些服务)

命令行参数:

不同的服务有不同的选项,一下两个是常见的参数:

-h:对于大多数的服务,可以添加-h看到文本的帮助

-c:对于一些服务,可以添加-c查看数据会更友好

例如:

adb shell dumpsys meminfo –h

image

子命令格式:

adb shell dumpsys package [-h] [-f] [—checkin] [cmd]…

参数

说明

-h打印帮助信息
-f打印intent filter的信息
--checkin打印出已经登记的库、系统功能、安装包
cmd子命令(可以在-h帮助文档中查看有哪些子命令)

cmd子命令

说明

prov[iders]获取content providers
p[ackages]获取安装包基本信息
s[hared-user]获取共享用户ID的应用
m[essages]打印运行时收集的信息
v[erifiers]打印包校验信息
version打印数据库版本信息
write写当前位置
<package.name>输出给定包的信息
installs安装会话的详细信息
l[ibraries]列出已知的共享库
f[ibraries]列出手机的功能
k[eysets]列出各个包的Signing KeySets
r[esolvers]获取intent filter
perm[issions]获取权限
pref[erred]打印包首选项
preferred-xml [—full]打印包首选项,xml格式打印

子命令格式:

adb shell dumpsys activity [-a] [-c]…

参数

说明

-a包括所有可用的服务器状态
-c包括客户端状态
-p限制输出为给定的包,例如: 

adb shell dumpsys activity -p com.android.browser

-h打印帮助信息
cmd子命令

cmd子命令

说明

a[ctivities]activity堆栈状态
r[recents]最近activity的状态
b[rodacasts] [package_name] [histpry [-s]]广播状态
i[ntents] [package_name]挂起的intent状态
p[rocesses] [package_name]进程状态
o[om]oom管理
perm[issions]url权限授权状态
prov[iders] [comp_spec…]content provider状态
provider [comp_spec]provider客户端状态
s[ervices] [comp_spec…]服务状态
as[sociations]跟踪应用程序的关联
service [comp_spec]服务客户端状态
package [package_name]给的包的所有状态
all转储所有的activityes
top转储栈顶的activity
write写入所有挂起状态存储
track-associations允许会话跟踪
untrack-associations禁用和明确会话跟踪,命令参数可能也是一个comp_spec 转储的activity

子命令

说明

命令格式

connectivity网络连接adb shell dumpsys connectivity
netpolicy网络策略adb shell dumpsys netpolicy
netstats网络状态adb shell dumpsys netstats
network_management网络管理adb shell dumpsys network_management

子命令说明命令格式
meminfo内存adn shell dumpsys meminfo
cpuinfoCPUadn shell dumpsys cpuinfo
gfxinfo帧率adn shell dumpsys gfxinfo
display显示adn shell dumpsys display
power电源adn shell dumpsys power
BATterystats电池状态adn shell dumpsys batterystats
battery电池adn shell dumpsys battery
alarm闹钟adn shell dumpsys alarm
location位置adn shell dumpsys location

一. 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信息

相关阅读

分享到:

栏目导航

推荐阅读

热门阅读