dmtracedump
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dmtracedump
là công cụ tạo
sơ đồ ngăn xếp lệnh gọi đồ họa từ các tệp nhật ký theo dõi. Công cụ này sử dụng tiện ích Graphviz
Dot để tạo đầu ra đồ họa, vì vậy, bạn cần cài đặt Graphviz
trước khi chạy dmtracedump
. Nếu bạn chưa tạo nhật ký theo dõi và lưu nhật ký từ thiết bị đã kết nối vào máy cục bộ, hãy chuyển đến Tạo nhật ký theo dõi bằng cách đo lường ứng dụng của bạn.
Công cụ dmtracedump
tạo dữ liệu ngăn xếp lệnh gọi dưới dạng sơ đồ cây, trong đó mỗi nút
đại diện cho một lệnh gọi phương thức. Báo cáo này cho thấy quy trình gọi (từ nút gốc đến nút con)
bằng cách sử dụng các mũi tên. Sơ đồ dưới đây cho thấy kết quả đầu ra mẫu của dmtracedump
.
Công cụ dmtracedump
được cung cấp trong gói Bộ công cụ SDK Android và
nằm trong android-sdk/platform-tools/
.
Cú pháp
Cách sử dụng dmtracedump như sau:
dmtracedump [-ho] [-s sortable] [-d trace-base-name] [-g outfile] trace-base-name
Sau đó, công cụ này sẽ tải dữ liệu nhật ký theo dõi từ trace-base-name.data
và
trace-base-name.key
.
Tùy chọn chung
Tuỳ chọn chung |
Mô tả |
-h |
Bật đầu ra HTML |
-o |
Kết xuất tệp theo dõi thay vì lập hồ sơ |
Lệnh và các tùy chọn lệnh
Lệnh và tuỳ chọn |
Mô tả |
-d trace-base-name |
Khác với tên truy xuất này |
-g outfile |
Tạo đầu ra cho outfile |
-s sortable |
Cơ sở URL đến vị trí của tệp javascript có thể sắp xếp |
-t percent |
Ngưỡng tối thiểu để đưa các nút con vào biểu đồ (thời gian bao gồm của nút con dưới dạng
phần trăm thời gian bao gồm của nút gốc). Nếu bạn không sử dụng tùy chọn này, ngưỡng mặc định
sẽ là 20%. |
Đầu ra
Hình 1. Ảnh chụp màn hình dmtracedump
Đối với mỗi nút trong biểu đồ, dmtracedump
sẽ hiển thị các thông tin
sau:
ref callname (inc-ms, exc-ms,numcalls)
ref
– Số tham chiếu cuộc gọi, được dùng trong nhật ký theo dõi
inc-ms
— Thời gian bao gồm đã qua (tính bằng mili giây trong phương thức,
bao gồm tất cả các phương thức con)
exc-ms
– Thời gian không bao gồm đã qua (tính bằng mili giây trong phương thức,
không bao gồm bất kỳ phương thức con nào)
numcalls
— Số cuộc gọi
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],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"]]