Mobile Development 11 min read

Android Performance Testing: Power Consumption, Network Traffic, and Weak‑Network Simulation

This article explains how to measure and analyze Android app performance issues such as excessive battery drain, high network traffic, and UI jank by using tools like tcpdump, Wireshark, Android’s TCP statistics, and weak‑network simulators such as clumsy, providing step‑by‑step commands and configuration tips.

Baidu Intelligent Testing
Baidu Intelligent Testing
Baidu Intelligent Testing
Android Performance Testing: Power Consumption, Network Traffic, and Weak‑Network Simulation

Background Android apps often suffer from high battery consumption, slow startup, memory leaks, and UI jank, which degrade user experience and therefore require systematic performance testing.

Power (Battery) Testing The main contributors to power usage are CPU, Wi‑Fi, mobile data, sensors (GPS, NFC), and screen wake‑locks. Battery usage can be inspected via Settings → Battery → Usage, which reads values from power_profile.xml . By monitoring component usage time with ADB commands and weighting them with the profile values, the app’s total power draw can be calculated.

Network Traffic Testing

Traffic is the total size of IP packets transmitted and received. Two methods are described:

1. tcpdump + Wireshark – Capture all packets on the device, filter by the target app (disable other apps’ network permissions), then compute the total bytes. Example commands:

adb push
/data/local/tcpdump
adb shell
su
chmod 6755 /data/local/tcpdump
/data/local/tcpdump -v -i any -s 0 -w /sdcard/zhangyu.pcap
adb pull /sdcard/zhangyu.pcap

Open the pcap file in Wireshark and read the “Bytes” column under Statistics → Summary for total traffic.

2. Android TCP Statistics – Use the per‑UID files under /proc/uid_stat/ / to read tcp_snd and tcp_rcv before and after the test, then compute the difference. Example steps:

adb shell
su
ps | grep com.example.app
cat /proc/uid_stat/1191/tcp_snd
cat /proc/uid_stat/1191/tcp_rcv

Calculate traffic as:

sent = tcp_snd_new - tcp_snd_old
received = tcp_rcv_new - tcp_rcv_old

Weak‑Network Simulation To evaluate app behavior under unstable networks, tools such as Charles, Fiddler, atc, clumsy, and netlimite are compared. The article recommends the third‑class tools (clumsy, netlimite) for daily use because they run on a PC and affect the device via a shared network.

Clumsy Setup and Usage

1. Prepare a Windows laptop, install the clumsy executable (no installation needed), and share the network with the phone.

2. Enable hosted Wi‑Fi on the laptop:

netsh wlan set hostednetwork mode=allow ssid=zhangyu1 key=123456789
netsh wlan start hostednetwork

The phone connects to this Wi‑Fi.

3. Launch clumsy, select a filter (e.g., tcp or specific ports), and enable desired impairments such as Lag, Drop, Throttle, Duplicate, Out‑of‑order, or Tamper to simulate latency, packet loss, bandwidth limits, etc.

Profiling Tools

After reproducing performance problems, the article suggests using TraceView, Systrace, and other Android profiling utilities. TraceView visualizes method execution time and call counts, while Systrace records system‑wide events (I/O, CPU load, kernel work queues) for deeper bottleneck analysis.

References are provided for further reading on mobile app performance evaluation and optimization.

AndroidPerformance Testingprofilingweak networkpower consumptionnetwork traffic
Baidu Intelligent Testing
Written by

Baidu Intelligent Testing

Welcome to follow.

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.