我正在寻找ADB shell dumpsys命令的完整列表,以及所有命令的完整解释.

我在哪里可以找到这些信息?

推荐答案

What's dumpsys and what are its benefit

dumpsys是一个安卓工具,在设备上运行,并转储有关系统服务状态的有趣信息.

明显的好处:

  1. 以简单的字符串表示形式轻松获取系统信息的可能性.
  2. 可以将转储的CPU、RAM、电池、存储统计信息用于 漂亮的图表,这将允许您判断您的应用程序 影响整个设备!

What information can we retrieve from dumpsys shell command and how we can use it

如果您运行哑元,您将看到大量的系统信息.但是你只能使用这个大垃圾场的不同部分.

要查看哑巴的所有"子命令",请执行以下操作:

dumpsys | grep "DUMP OF SERVICE"

输出:

DUMP OF SERVICE SurfaceFlinger:
DUMP OF SERVICE accessibility:
DUMP OF SERVICE account:
DUMP OF SERVICE activity:
DUMP OF SERVICE alarm:
DUMP OF SERVICE appwidget:
DUMP OF SERVICE audio:
DUMP OF SERVICE backup:
DUMP OF SERVICE battery:
DUMP OF SERVICE batteryinfo:
DUMP OF SERVICE clipboard:
DUMP OF SERVICE connectivity:
DUMP OF SERVICE content:
DUMP OF SERVICE cpuinfo:
DUMP OF SERVICE device_policy:
DUMP OF SERVICE devicestoragemonitor:
DUMP OF SERVICE diskstats:
DUMP OF SERVICE dropbox:
DUMP OF SERVICE entropy:
DUMP OF SERVICE hardware:
DUMP OF SERVICE input_method:
DUMP OF SERVICE iphonesubinfo:
DUMP OF SERVICE isms:
DUMP OF SERVICE location:
DUMP OF SERVICE media.audio_flinger:
DUMP OF SERVICE media.audio_policy:
DUMP OF SERVICE media.player:
DUMP OF SERVICE meminfo:
DUMP OF SERVICE mount:
DUMP OF SERVICE netstat:
DUMP OF SERVICE network_management:
DUMP OF SERVICE notification:
DUMP OF SERVICE package:
DUMP OF SERVICE permission:
DUMP OF SERVICE phone:
DUMP OF SERVICE power:
DUMP OF SERVICE reboot:
DUMP OF SERVICE screenshot:
DUMP OF SERVICE search:
DUMP OF SERVICE sensor:
DUMP OF SERVICE simphonebook:
DUMP OF SERVICE statusbar:
DUMP OF SERVICE telephony.registry:
DUMP OF SERVICE throttle:
DUMP OF SERVICE usagestats:
DUMP OF SERVICE vibrator:
DUMP OF SERVICE wallpaper:
DUMP OF SERVICE wifi:
DUMP OF SERVICE window:

Some Dumping examples and output

1) 获取所有可能的电池统计数据:

$~ adb shell dumpsys battery

您将获得以下输出:

Current Battery Service state:
AC powered: false
AC capacity: 500000
USB powered: true
status: 5
health: 2
present: true
level: 100
scale: 100
voltage:4201
temperature: 271 <---------- Battery temperature! %)
technology: Li-poly <---------- Battery technology! %)

2)获取WiFi信息

~$ adb shell dumpsys wifi

输出:

Wi-Fi is enabled
Stay-awake conditions: 3

Internal state:
interface tiwlan0 runState=Running
SSID: XXXXXXX BSSID: xx:xx:xx:xx:xx:xx, MAC: xx:xx:xx:xx:xx:xx, Supplicant state: COMPLETED, RSSI: -60, Link speed: 54, Net ID: 2, security: 0, idStr: null
ipaddr 192.168.1.xxx gateway 192.168.x.x netmask 255.255.255.0 dns1 192.168.x.x dns2 8.8.8.8 DHCP server 192.168.x.x lease 604800 seconds
haveIpAddress=true, obtainingIpAddress=false, scanModeActive=false
lastSignalLevel=2, explicitlyDisabled=false

Latest scan results:

Locks acquired: 28 full, 0 scan
Locks released: 28 full, 0 scan

Locks held:

3)获取CPU信息

~$ adb shell dumpsys cpuinfo

输出:

Load: 0.08 / 0.4 / 0.64
CPU usage from 42816ms to 34683ms ago:
system_server: 1% = 1% user + 0% kernel / faults: 16 minor
kdebuglog.sh: 0% = 0% user + 0% kernel / faults: 160 minor
tiwlan_wq: 0% = 0% user + 0% kernel
usb_mass_storag: 0% = 0% user + 0% kernel
pvr_workqueue: 0% = 0% user + 0% kernel
+sleep: 0% = 0% user + 0% kernel
+sleep: 0% = 0% user + 0% kernel
TOTAL: 6% = 1% user + 3% kernel + 0% irq

4) 获取内存使用信息

~$ adb shell dumpsys meminfo 'your apps package name'

输出:

** MEMINFO in pid 5527 [com.sec.android.widgetapp.weatherclock] **
                    native   dalvik    other    total
            size:     2868     5767      N/A     8635
       allocated:     2861     2891      N/A     5752
            free:        6     2876      N/A     2882
           (Pss):      532       80     2479     3091
  (shared dirty):      932     2004     6060     8996
    (priv dirty):      512       36     1872     2420

 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        0       Activities:        0
          Assets:        3    AssetManagers:        3
   Local Binders:        2    Proxy Binders:        8
Death Recipients:        0
 OpenSSL Sockets:        0


 SQL
               heap:        0         MEMORY_USED:        0
 PAGECACHE_OVERFLOW:        0         MALLOC_SIZE:        0

如果要查看所有进程的信息,请使用~$ adb shell dumpsys meminfo

在此处输入图像描述

dumpsys最终是灵活和有用的工具!

如果你想使用这个工具,别忘了将权限自动添加到你的android list 中

try 测试所有命令以了解有关dumpsys的更多信息.倾倒快乐!

Android相关问答推荐

房间打开创建回调java.nio.channels. OverlappingFilLockResponse

如何让用户与我的应用生成的多个音频文件交互

如何在Reaction Native中显示Google Map iFrame?

Android Jetpack Compose Material3主题配色方案

即使安装了Chrome和YouTube,Android对action_view a YouTube URL的意图也是空的

Android开发:主题排版不适用于按钮文本

如何禁用Android 34+版的TileService,但保留以前的版本?

Android:微调:在代码中设置ArrayAdapter不希望调用On ItemSelected,仅当用户单击微调时调用

Android App Google AdMob";广告加载失败:3;带有测试ID,&q;广告加载失败:1 for My Gahad

如何在Android中将以前的数据保存在复选框中?

为什么 Android Compose 将片段作为参数传递给 Composables 函数?

有没有办法迭代类型安全的项目访问器?

了解 CoroutineScope(Job() + Dispatchers.Main) 语法

如何在 Jetpack Compose 中对齐按钮底部中心?

Jetpack Compose 中的滑动按钮菜单

如何放置在柱子的角落(底端)

如何为具有不同屏幕尺寸但相同密度的手机创建响应式布局?

jetpack compose 中的可点击指示是什么?

Android全屏AlertDialog

ObjectBox,如何在冲突中放弃一切迁移?