HarmonyOS App Performance Analysis

端到端鸿蒙
应用性能分析
End-to-end
HarmonyOS app
performance analysis

宿主 Agent 理解问题并决定下一步;Diting 在设备上执行操作、抓取 HTrace,完成有界取证、确定性校验和 HTML 报告。 The host agent understands the problem and decides what to do next. Diting operates the device, captures an HTrace, gathers bounded evidence, validates it, and renders an HTML report.

两种入口:设备或 Trace。Two entry points: a device or a trace.

可以从设备现场开始,也可以从已有 HTrace 开始。两种入口进入同一套分析、校验和报告流程。 Start from a live device, or from an HTrace you already have. Both paths lead into the same analysis, validation, and reporting pipeline.

连接设备、操作界面并抓取 Trace。Connect a device, operate the UI, and capture a trace.

设备工具可以读取当前屏幕和控件树,执行 tap、swipe、key、text,再调用 hiprofiler 抓取带 ftrace 和可选 hiperf 的 Trace。抓取期间也能继续执行 UI 步骤。 Device tools read the current screen and control tree, perform tap, swipe, key, and text actions, then call hiprofiler to capture ftrace and optional hiperf data. UI steps can run during capture.

01识设备Detectinspect_device
02看屏幕Inspectinspect_screen
03操作Actact
04抓 TraceCapturecapture_trace

设备工具默认关闭,需要在启动时加 --enable-device;act 会真实操作设备。 Device tools are opt-in via --enable-device. act really operates the device.

查看设备工作流Device workflow

已经有一份 HTrace,通过 Agent 会话分析。Already have an HTrace? Analyse it through an agent session.

宿主 Agent 调用 open_trace 转换并打开 Trace,再调用 begin_analysis 声明场景、现象和边界。首次转换结果会写入内容寻址缓存。 The host agent calls open_trace to convert and open the trace, then begin_analysis to declare the scenario, symptom, and boundary. The conversion is cached by content hash.

tool callshost agent
open_trace("case.htrace")

begin_analysis(
  scenario_type="frame-jank",
  scenario="scroll list",
  symptom="repeated dropped frames",
  refresh_rate_hz=120
)
工具与流程tools and workflow

工具能力Tool capabilities

默认 34 个 工具,开启设备工具后 45 个。这里按主要任务分组。 34 tools by default, 45 with device tools enabled. They are grouped by task.

16

Trace 取证Trace inspection

概览、进程/线程、CPU/内存/IO、受限 SQL、四类场景、单帧下钻、线程执行和 Perf Profile。Overview, processes and threads, CPU/memory/IO, restricted SQL, four scenarios, frame drill-down, thread execution, and Perf profiles.

get_trace_overview · query_trace_sql · inspect_*
11

设备与环境Device & environment

查看设备和屏幕、执行 UI 操作、抓取 Trace、检查应用包与 native 库、拉取文件、检查和安装运行环境。需显式开启。Inspect devices and screens, operate the UI, capture traces, inspect app packages and native libraries, pull files, and check or install the environment. Explicitly opt-in.

inspect_screen · act · capture_trace · install_environment
06

会话与报告Session & report

转换并复用 Trace、声明分析边界、提交确定性校验、生成自包含 HTML 报告。Convert and reuse a trace, declare the analysis boundary, submit deterministic validation, and render a self-contained HTML report.

open_trace · begin_analysis · submit_analysis_result · render_report
05

证据与 bundleEvidence & bundles

列出或读取 Evidence;导出、导入和比较带 digest 的 bundle。List or read evidence; export, import, and compare digest-checked bundles.

list_evidence · get_evidence · export_bundle · import_bundle · compare_bundles
07

未知与 handoffUnknowns & handoff

记录、更新、列出和验证未知项;导出或恢复会话 handoff 快照。Record, update, list, and verify unknowns; snapshot or resume a session handoff.

record_unknown · update_unknown · snapshot_session · resume_session

报告内容Report contents

每次分析生成一份自包含的 report.html,离线可打开。旁边保留 findings、evidence、unknowns、validation 和 run 元数据,方便复查与归档。 Each run produces a self-contained report.html that opens offline, with findings, evidence, unknowns, validation, and run metadata kept alongside it for review and archiving.

  • report.htmlself-contained
  • findings.jsonclaims
  • evidence.jsonproof
  • unknowns.jsongaps
  • validation.jsonchecks
  • run.jsonmetadata
DitingAgent 完成时延分析报告截图 / Screenshot of the DitingAgent completion-latency report
实际输出示例:完成时延报告摘要Actual output: completion-latency report summary 查看原图 ↗Open image ↗

Agent + Diting,自动完成一次分析。Agent + Diting: one automated analysis.

描述问题,Agent 负责判断和决策;Diting 在设备上执行操作、抓取 HTrace、返回取证结果并生成报告。 Describe the problem. The agent decides what to do; Diting acts on the device, captures the trace, returns evidence, and renders the report.

对 Agent 说Say to the agent

分析这个应用冷启动慢的问题。连接设备复现,抓取 HTrace,定位启动关键路径,并生成带证据的报告。 Analyze why this app is slow to cold start. Reproduce it on the device, capture an HTrace, trace the startup critical path, and produce an evidence-backed report.

Agent → Diting Agent / device / trace

执行链Execution

  1. 01
    Agent 复现问题Agent reproduces it

    连接设备,执行必要操作,确认目标场景。Connect the device, act, and confirm the target scenario.

  2. 02
    Diting 抓取 TraceDiting captures the trace

    抓取 HTrace,或打开已有 Trace。Capture an HTrace, or open an existing trace.

  3. 03
    Agent 选择工具,Diting 取证Agent selects tools; Diting gathers evidence

    按场景调用有界工具,返回 Evidence 和摘要。Call bounded tools by scenario and return evidence with summaries.

  4. 04
    校验并生成报告Validate and render

    确定性校验后输出 HTML 报告和完整证据。Run deterministic validation, then render the HTML report and evidence.

查看完整分析流程See the full analysis flow