iOS CPU Usage
The CPU Usage metric measures the absolute percentage of CPU consumed by the app during a 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. It also shows the average and maximum CPU used by the app during a session.
In the app performance report, go to the CPU Usage section to view the CPU consumption by the app during the 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 used by the app at a particular time in the session since the session started. The Y-axis starts with 0% of CPU capacity.
Example
In the following example, you can see that the average CPU used by the app is 1.42% and the maximum CPU used by the app is 21.45% during the session. This percentage might be calculated considering one or more cores of the CPU.
Impact on user experience
When an iOS app uses excessive CPU, it can negatively impact the user experience by causing the device to slow down, become unresponsive, or freeze. This can lead to a frustrating experience for users and also drain the device’s battery faster.
Threshold guidelines
The recommended threshold is less than 20% CPU utilization 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:
- Use Grand Central Dispatch (GCD): Use GCD to run heavy or long tasks in the background instead of the main thread to avoid app unresponsiveness and freezing.
- Reduce animations: Limit or simplify the animations in the app to avoid high CPU usage, use simpler animations or none at all.
- Use energy-efficient APIs: Choose energy-efficient APIs for tasks like image processing, audio playback, and networking to reduce CPU usage.
- Avoid long-running operations on the main thread: Prevent UI freezes and jank by running computationally expensive tasks in background threads.
- Schedule background work efficiently: Schedule background work to minimize CPU usage and improve app performance.
- Use hardware acceleration and caching: Reduce CPU usage by utilizing hardware acceleration and caching for graphics and image processing operations.
- Use Instruments: Optimize CPU-intensive operations by using Xcode’s Instruments tool to identify any bottlenecks or areas of the app causing excessive CPU usage.
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!