dumpsys命令的用法

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

一. 初识dumpsys

adb shell                         //进入手机shell
dumpsys | grep "DUMP OF SERVICE"  //列举当前手机所有支持的dumpsys命令

运行上面指令,结果(不同手机结果会有所差异)

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:

二. dumpsys用法

(1)前面输入每一行都是都可以组成一条dumpsys指令。例如:DUMP OF SERVICE meminfo

dumpsys meminfo    //输出当前所有memory相关的信息

(2)当我们想查看具体某个应用的内存使用情况,例如QQ:

dumpsys meminfo com.tencent.mobileqq

运行结果:

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

(3)帮助信息

dumpsys meminfo -h  //此处以meminfo为例,其他指令也是类同

运行结果

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.

三. dumpsys常用指令

dumpsys指令很多, 下面列举一些常用的dumpsys指令的功能


 dumpsys package     //查看指定包名的信息
 dumpsys activity   //查看指定包名的activity信息

 dumpsys alarm      //查看Alarm信息
 dumpsys audio      //查看声音信息
 dumpsys battery    //查看电池信息
 dumpsys cpuinfo //查看CPU信息
 dumpsys meminfo  //查看指定包名的内存信息
 dumpsys netstats//查看网络统计信息
 dumpsys diskstats   //查看空间free状态
 dumpsys jobscheduler   //查看任务计划
 dumpsys power//查看功耗信息
 dumpsys wifi//查看wifi信息

你可能感兴趣的:(android)