Performance Testing Metrics and Sampling Strategy for Android Apps
The article outlines a comprehensive set of Android app performance metrics, device coverage, a non‑root sampling strategy using dumpsys commands, shell‑based data collection, and Python‑driven HTML reporting, providing practical guidance and reference implementations for mobile developers.
After clarifying basic concepts, the article defines the set of performance metrics to be collected during testing, including component initialization time, app launch time (cold and hot), CPU usage, PSS memory usage, battery temperature, FPS, hardware dropped frames, average frame render time, and custom business‑specific timestamps.
Test devices span multiple Android OS versions (4.0‑6.0), brands (Huawei, Xiaomi, Nexus, VIVO, etc.) and resolutions (1920×1080, 2560×1440, 1280×720, 854×480). The business scenario is omitted.
The sampling strategy follows a solution by @sandman: use the command dumpsys SurfaceFlinger | grep "|....|" to obtain the top window name, keep a history of 127 lines (≈2.12 s at 60 fps) to avoid frequent queries, clear latency data periodically with dumpsys SurfaceFlinger --latency-clear, compute FPS only when a new frame appears, and record additional metrics such as average frame render time.
Implementation details involve a shell script that runs on the device, writes the collected data to a CSV file, and pulls it to a PC via adb pull. The CSV is later processed by a Python script that generates an HTML report. The approach does not require a rooted device.
Reference implementations can be found in Chromium’s surface_stats_collector.py and a detailed blog post here . Full tool package (including the Python reporting code) is available at https://yunpan.cn/ckcypyNLDAet2 (extraction code: 005f).
Sample reports generated by the tool are shown in the accompanying screenshots.
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.
360 Quality & Efficiency
360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.
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.
