WPS Open-Sources Harmony Trace Analyzer for Automated HarmonyOS Performance Analysis
WPS has open-sourced Harmony Trace Analyzer, a command-line tool that automates performance bottleneck detection for HarmonyOS applications using HiTrace tags, flame graphs, hotspot clustering, and AI-assisted diagnosis, reducing per-case analysis time from 5 minutes to 1 minute and saving over 130 engineering hours per performance sprint.
Core Capabilities: End-to-End Automated Performance Analysis Loop
Harmony Trace Analyzer addresses the inefficiency of manual trace analysis in HarmonyOS app development. Traditional analysis requires engineers to open Profiler, locate time ranges, capture flame graphs, and judge hotspots frame by frame — taking minutes per trace. With automated testing generating hundreds or thousands of traces, manual analysis becomes a bottleneck.
The tool builds a complete automated pipeline around five capabilities:
Precise Measurement: Uses HiTrace tags in application code as exact start/end boundaries. The tag's duration equals the operation's true latency, achieving near 100% detection rate without inferring frame boundaries. Developers add standard HiTrace tags to key paths (document opening, spreadsheet calculation, page rendering) for millisecond-level latency measurement.
Root-Cause Localization: Automatically generates CPU flame graphs for each tag interval, showing call-stack time distribution. Supports independent perf hotspot statistics for business worker threads, distinguishing UI, rendering, and background threads at function granularity. Cross-dimensional analysis lets developers understand performance issues without opening Profiler.
Automatic Hotspot Identification: Encodes expert experience into rules: traverse flame graph from root downward to locate the first node layer with <90% share, then output that layer and its upper hotspot functions. This solves the "tail spike" problem in flame graphs and lowers the analysis barrier for junior engineers.
Multi-Dimensional Clustering: Clusters hotspots across multiple traces, automatically ranking top hotspot functions and their representative traces. Helps experts quickly find high-frequency bottlenecks and avoid repetitive needle-in-haystack searches. The full chain from trace capture, symbol import, flame graph viewing, bottleneck discovery to clustering statistics is automated, providing structured, traceable input for experts.
Batch Processing: Scans an entire trace directory, auto-sorts, runs concurrent analysis, and skips already-processed files incrementally. Engineers specify an input directory to get a structured summary report covering all cases. Reports can be sorted by latency to surface worst cases instantly. Analysis can resume from breakpoints with completed results preserved.
AI-Assisted Diagnosis: Integrates large models to deeply analyze hotspot frame data, automatically producing structured root-cause descriptions, key hotspot functions, and optimization suggestions written back into the summary report. This creates a complete "detect → understand → advise" loop, shortening engineers' decision cycles.
The tool also supports a directory-watch mode for seamless CI/CD integration: when test machines produce traces, analysis triggers automatically, delivering "report ready when test finishes" continuous integration.
Simple Integration for Broad HarmonyOS App Reuse
The design is not bound to specific business logic. Any HarmonyOS app that adds HiTrace tags to critical paths can use the tool directly. It supports mainstream trace formats (.htrace, .ftrace, .db) and outputs results in CSV (for Excel pivot tables), JSON (for programmatic processing and secondary integration), and HTML (visual charts and interactive tables viewable in a browser). Whether for e-commerce page loads, social-app message rendering, or office-app document operations, as long as HiTrace tags define "where to start and where to end," the tool enables automatic measurement and diagnosis. The leap from single-point manual analysis to scaled automated pipeline requires only a directory and one command.
Open-Source Collaboration: Building New Infrastructure for HarmonyOS Performance Analysis
Harmony Trace Analyzer's open-source release is the first external output of joint performance-engineering work by the HarmonyOS Strike Team and WPS, and a key step toward filling the gap in large-scale performance analysis infrastructure for the HarmonyOS ecosystem. The tool adopts a decoupled design separating the analysis core from the batch-scheduling layer, offering strong extensibility for diverse HarmonyOS app scenarios. The project is hosted on GitCode (https://gitcode.com/diting/harmony_trace_analyzer) with ongoing maintenance and version iterations. The team welcomes issue feedback, feature contributions, and direct enterprise adoption for internal performance sprints, jointly advancing standardization of the HarmonyOS performance analysis toolchain. Huawei plans to deepen cooperation with ecosystem partners to release scenario-specific developer solutions across foundational technologies, general capabilities, and vertical industries, continuously improving HarmonyOS app innovation experience and development efficiency.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
HarmonyOS Developer Technology
HarmonyOS developers provide key technology analysis, version updates, Codelabs practice, and event information for HarmonyOS. Welcome developers to join the HarmonyOS ecosystem and create infinite possibilities together!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
