Mobile Development 7 min read

Android Performance Testing: Methods for Collecting CPU, Memory, FPS, Traffic, Thread, and Power Data

This guide explains how to obtain, calculate, and interpret key Android performance metrics—including CPU usage, memory consumption, frame rate, network traffic, thread activity, and power consumption—using adb commands, code snippets, and best‑practice recommendations.

360 Tech Engineering
360 Tech Engineering
360 Tech Engineering
Android Performance Testing: Methods for Collecting CPU, Memory, FPS, Traffic, Thread, and Power Data

The article focuses on the Android performance metrics that are most commonly monitored—CPU, memory, power consumption, frame rate, threads, and network traffic—and describes how to collect, calculate, and handle the data for each metric.

CPU : The method varies by ROM. For devices with SDK > 25, use adb shell top -s 1 -o %CPU -o ARGS -n 1 to filter the target process; for SDK <= 25, use adb shell top -n 1 . Record data every second, then compute average and peak values. Recommendations include sampling every 1–3 seconds, separating memory and CPU tests for precise values, summing across multiple processes, and dividing by core count (obtain core count via adb shell cat /proc/cpuinfo and count occurrences of “processor”).

Memory : Run adb shell dumpsys meminfo + pro (replace pro with the process name) and read the TOTAL line for overall memory usage. Sample at the same 1‑second interval and record average and peak values.

Frame Rate (FPS) : Use dumpsys gfxinfo + pro reset to clear previous data, then dumpsys gfxinfo + pro to obtain Total frames rendered and Janky frames . Calculate the frame rate with total / (total + janky) * 60 . Sample every second and keep the minimum value for analysis.

Network Traffic : Obtain upload and download bytes via the Android TrafficStats API: long up = TrafficStats.getUidTxBytes(uid); long receive = TrafficStats.getUidRxBytes(uid); Total traffic equals up + receive . Compute consumption by taking the difference between values captured before and after the test. If the API returns –1, fall back to a manual method that reads /proc/uid_stat/ /tcp_rcv and /proc/uid_stat/ /tcp_snd files: File uidFileDir = new File("/proc/uid_stat/" + String.valueOf(uid)); File uidActualFileReceived = new File(uidFileDir, "tcp_rcv"); File uidActualFileSent = new File(uidFileDir, "tcp_snd"); Read the two files and sum their contents to obtain upload and download totals.

Thread Monitoring : For SDK > 25 use adb shell ps –T ; for SDK <= 25 use adb shell ps –t to list all threads of the target app. Compare thread counts between page A and page B to detect leaked or unreleased threads, and repeat the navigation to confirm suspicious threads.

Power Consumption : Enable full‑wake history with adb shell dumpsys batterystats --enable full-wake-history and reset counters via adb shell dumpsys batterystats --reset . After performing the test steps, generate a bugreport ( adb bugreport bugreport.zip for SDK >= 24, otherwise adb bugreport > bugreport.txt ) and analyze it with Google’s Battery Historian tool (https://github.com/google/battery-historian).

All the above procedures can be automated with scripts or test cases, and the collected data can be plotted as curves to visualize performance trends. The guide concludes with a reminder that the described methods constitute the common Android performance testing toolkit.

Androidperformance testingCPUmemoryFPSpower consumptionnetwork trafficThread Monitoring
360 Tech Engineering
Written by

360 Tech Engineering

Official tech channel of 360, building the most professional technology aggregation platform for the brand.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.