Android CPU Usage
The CPU Usage metric measures the absolute percentage of the device’s CPU capacity used by the app during the test session. The absolute percentage might be calculated by considering one or more cores of the CPU, depending on the number of cores used during the session. The graph also highlights the average and maximum CPU capacity used by the app in a session.
In the app performance report, go to the CPU Usage section to view the CPU consumption by the app during a session. In the graph, the axes represent the following:
- X-axis: Depicts the time (in seconds) elapsed since the start of the session. 0 on the X-axis represents the start of the profiling session.
- Y-axis: Depicts the absolute percentage of CPU capacity used by the app at a particular time since the start of the session. The Y-axis starts with 0% of CPU capacity.
Example
In the following graph, you can see that at 53.36s the app used 9.08% of the CPU capacity. This percentage might be calculated considering one or more cores of the CPU. The graph also shows that the average CPU used by the app is 3.1% and the maximum CPU used by the app is 9.7%.
With this metric, you can identify when was the highest CPU usage by the app and which action/workflow caused this increase. To identify the actions or workflows that cause excessive CPU usage, you can play the test session video. Alongside the video, a bar moves on the graph to help you identify the actions or workflows of your interest.
Impact on user experience
High CPU utilization by an Android app can impact user experience by causing the device to slow down, freeze, or become unresponsive. It can also drain the device’s battery faster, leading to a poor user experience.
Threshold guidelines
Recommended threshold is CPU utilization of less than 20% at all times.
If your app exceeds the threshold, App Performance Testing flags an issue in the performance report. To know more about the issue, see App performance issues - CPU Usage.
Recommendations
The following are the recommendations to improve CPU usage:
- Avoid performing long-running or computationally expensive operations on the main thread, as this can lead to UI freezes and jank. Move such operations to background threads.
- Schedule background work efficiently and minimize CPU usage.
- Optimize the amount of work done by the CPU. Avoid unnecessary loops, and use efficient data structures like HashMaps or SparseArrays.
- Use hardware acceleration and caching where possible to reduce CPU usage for graphics and image processing operations.
Related topics
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!