dmtracedump
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
dmtracedump
是一种用于从跟踪日志文件生成图形化调用堆栈图的工具。此工具使用 Graphviz Dot 实用程序创建图形化的输出,因此您必须先安装 Graphviz,才能运行 dmtracedump
。如果尚未生成跟踪日志并将其从连接的设备保存到本地计算机,请转到通过检测您的应用生成跟踪日志。
dmtracedump
工具以树形图的形式生成调用堆栈数据,其中每个节点表示一个方法调用。它使用箭头显示调用流程(从父节点到子节点)。下图显示了 dmtracedump
的示例输出。
dmtracedump
工具在 Android SDK 工具软件包中提供,并位于 android-sdk/platform-tools/
下。
语法
dmtracedump 的用法如下:
dmtracedump [-ho] [-s sortable] [-d trace-base-name] [-g outfile] trace-base-name
然后,此工具会从 trace-base-name.data
和 trace-base-name.key
加载跟踪日志数据。
全局选项
全局选项 |
说明 |
-h |
开启 HTML 输出 |
-o |
转储跟踪文件,而不是进行剖析 |
命令和命令选项
命令和选项 |
说明 |
-d trace-base-name |
以此跟踪名称作为参数运行 diff |
-g outfile |
生成 outfile 输出 |
-s sortable |
可排序 JavaScript 文件所在位置的基址 |
-t percent |
在图表中包含子节点的最低阈值(子节点的包含时间显示为占父节点包含时间的百分比)。如果未使用此选项,默认阈值为 20%。 |
输出
图 1. dmtracedump 的屏幕截图
对于此图表中的每个节点,dmtracedump
都会显示以下信息:
ref callname (inc-ms, exc-ms,numcalls)
ref
- 跟踪日志中使用的调用引用号
inc-ms
- 包含时长(在方法中花费的毫秒数,包括所有子方法)
exc-ms
- 包含时长(在方法中花费的毫秒数,不包括任何子方法)
numcalls
- 调用次数
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# dmtracedump\n\n`dmtracedump` is a tool that generates\ngraphical call-stack diagrams from trace log files. The tool uses the Graphviz\nDot utility to create the graphical output, so you need to install Graphviz\nbefore running `dmtracedump`. If you haven't yet generated trace logs and\nsaved them from your connected device to your local machine, go to\n[Generate trace logs by instrumenting your app](/studio/profile/generate-trace-logs).\n\nThe `dmtracedump` tool generates the call stack data as a tree diagram, where each\nnode represents a method call. It shows call flow (from parent node to child nodes)\nusing arrows. The diagram below shows a sample output of `dmtracedump`.\n\nThe `dmtracedump` tool is provided in the Android SDK Tools package and is\nlocated in \u003cvar translate=\"no\"\u003eandroid-sdk\u003c/var\u003e`/platform-tools/`.\n\nSyntax\n------\n\nThe usage for dmtracedump is: \n\n```\ndmtracedump [-ho] [-s sortable] [-d trace-base-name] [-g outfile] trace-base-name\n```\n\nThe tool then loads trace log data from \u003cvar translate=\"no\"\u003etrace-base-name\u003c/var\u003e`.data` and\n\u003cvar translate=\"no\"\u003etrace-base-name\u003c/var\u003e`.key`.\n\n### Global options\n\n| Global options | Description |\n|----------------|------------------------------------------|\n| `-h` | Turn on HTML output |\n| `-o` | Dump the trace file instead of profiling |\n\n### Commands and command options\n\n| Commands and options | Description |\n|------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `-d `\u003cvar translate=\"no\"\u003etrace-base-name\u003c/var\u003e | Diff with this trace name |\n| `-g `\u003cvar translate=\"no\"\u003eoutfile\u003c/var\u003e | Generate output to \u003cvar translate=\"no\"\u003eoutfile\u003c/var\u003e |\n| `-s `\u003cvar translate=\"no\"\u003esortable\u003c/var\u003e | URL base to the location of the sortable javascript file |\n| `-t `\u003cvar translate=\"no\"\u003epercent\u003c/var\u003e | Minimum threshold for including child nodes in the graph (child's inclusive time as a percentage of parent inclusive time). If this option is not used, the default threshold is 20%. |\n\nOutput\n------\n\n\n**Figure 1.** Screenshot of dmtracedump\n\n\u003cbr /\u003e\n\nFor each node in the graph, `dmtracedump` shows the following\ninformation: \n\n```\nref callname (inc-ms, exc-ms,numcalls)\n```\n\n- \u003cvar translate=\"no\"\u003eref\u003c/var\u003e --- Call reference number, as used in trace logs\n- \u003cvar translate=\"no\"\u003einc-ms\u003c/var\u003e --- Inclusive elapsed time (milliseconds spent in method, including all child methods)\n- \u003cvar translate=\"no\"\u003eexc-ms\u003c/var\u003e --- Exclusive elapsed time (milliseconds spent in method, not including any child methods)\n- \u003cvar translate=\"no\"\u003enumcalls\u003c/var\u003e --- Number of calls"]]