| <html devsite><head> |
| <title>dumppsys 系统诊断</title> |
| <meta name="project_path" value="/_project.yaml"/> |
| <meta name="book_path" value="/_book.yaml"/> |
| </head> |
| <body> |
| <!-- |
| Copyright 2017 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <p><code>dumpsys</code> 工具可在设备上运行,并提供有关系统服务状态的信息。</p> |
| |
| <h2 id="how_to_use_dumpsys">如何使用 dumpsys</h2> |
| |
| <p>如果您运行 <code>adb shell dumpsys</code>,则会获得所有系统服务的诊断输出内容,这些输出内容通常比您需要的还要多。要获得更易于处理的输出内容,请指定要检查的服务。</p> |
| |
| <p>例如,运行以下命令:</p> |
| |
| <pre> |
| $ adb shell dumpsys input |
| </pre> |
| |
| <p>提供输入组件(例如触摸屏或内置键盘)的系统数据。</p> |
| |
| <h2 id="list_of_system_services">系统服务列表</h2> |
| |
| <p>要获取可用于 dumpsys 的系统服务的完整列表,请尝试运行以下命令:</p> |
| |
| <pre class="no-pretty-print"> |
| $ adb shell dumpsys -l |
| Currently running services: |
| DockObserver |
| SurfaceFlinger |
| accessibility |
| account |
| activity |
| alarm |
| android.security.keystore |
| appops |
| appwidget |
| assetatlas |
| audio |
| backup |
| battery |
| batteryproperties |
| batterystats |
| bluetooth_manager |
| clipboard |
| connectivity |
| consumer_ir |
| content |
| country_detector |
| cpuinfo |
| dbinfo |
| ... |
| </pre> |
| |
| <h2 id="dumpsys_command-line_options">dumppsys 命令行选项</h2> |
| |
| <p>命令行选项因服务而异。以下是几个常见的命令行选项:</p> |
| |
| <ul> |
| <li>对于许多服务,您可以附加 <code>-h</code> 来查看帮助文本。 |
| </li><li>对于某些服务,您可以附加 <code>-c</code> 来查看计算机可读取格式的数据。</li></ul> |
| |
| <h2 id="understanding_diagnostic_output">了解诊断输出</h2> |
| |
| <p>要详细了解一些最常用的 dumpsys 服务,请参阅以下文章:</p> |
| |
| <ul> |
| <li> <a href="/devices/input/diagnostics.html">查看输入诊断信息 (dumpsys input)</a> |
| </li><li> <a href="procstats.html">查看 RAM 使用情况数据 (dumpsys procstats)</a> |
| </li><li> <a href="netstats.html">查看网络数据 (dumpsys netstats)</a> |
| </li><li> <a href="/devices/tech/power/batterystats.html">查看电池使用情况数据 (dumpsys batterystats)</a> |
| </li></ul> |
| |
| </body></html> |