Measuring your app’s power use with Power Profiler
Profile your app’s power impact whether or not your device is connected to Xcode.
Overview
Various subsystems of a device require the device to draw additional power from its battery when your app uses them. Using these subsystems efficiently can reduce your app’s power demand, increasing the time before someone needs to recharge the battery and improving their experience of using your app. For more information, see Analyzing your app’s battery use.
Use Power Profiler in Instruments to gather and analyze data on your app’s use of device subsystems that increase power consumption. Alternatively, record a performance trace using Power Profiler on your device while you’re away from your desk, and visualize the data in Instruments. Power Profiler is available on iPhone with iOS 26 or later, and iPad with iPadOS 26 or later.
Create a plan to adopt power-efficient designs and API best practice to reduce your app’s power consumption, based on what you find in your analysis. Compare the trace data before and after you make changes to verify that the changes reduce your app’s power consumption.
Record and analyze a power trace using Instruments
Make sure your device is available in Xcode, either wirelessly or using a cable, and set the run destination in Xcode to the device you want to use. For more information, see Running your app in Simulator or on a device. Record a power trace by following these steps:
In Xcode, choose Product > Profile.
In Instruments the Choose a Template… window opens, choose the Blank template.
Click the Add Instrument button, and choose the Power Profiler instrument.
Choose the target device and app to record. If you choose All Processes, Instruments only records a power trace for the overall system, and doesn’t report power metrics for your app.
Click record to start gathering data.
Interact with the features in your app that you want to analyze.
In Instruments, click the Stop button to stop gathering data.
[Image]
The Power Profiler track in Instruments shows the overall system power usage, represented as a fraction of total battery energy consumed per hour. Additionally, it shows the following information:
Whether the device is connected to a charger
The device’s thermal state
The display brightness
Periods when Apple silicon is asleep
Xcode keeps Apple silicon awake while it’s paired with your device, so Instruments only shows sleep and wake events when you collect a performance trace on a device that isn’t connected with Xcode. See Gather power-consumption data on a device.
Click the disclosure triangle to the left of the track to expand the Power Profiler track. The Power Profiler shows a track for the app or extension you target. The track includes lanes that show the power impact that the process causes due to its use of CPU, GPU, display, and networking.
Higher values for power impact metrics represent greater power use. You can compare the power impact metrics with each other in the timeline, for example, to see whether your app causes greater power impact due to its networking use than its CPU use, and prioritize subsystems for further investigation. You can compare power impact metrics over time, including for multiple traces on the same device.
Click the disclosure triangle next to your app’s track to reveal lanes that provide more detailed information about your app’s usage of device subsystems.
Gather power-consumption data on a device
Some scenarios are difficult to replicate on a device that’s connected to your Mac, for example, low-battery situations, and using your app with CarPlay. In these cases, collect a performance trace on the device, and transfer it to your Mac later to analyze in Instruments. People testing your app can also collect performance traces as they use your app, and share the trace files with you.
To set up a device to gather a performance trace that contains power metrics:
Follow the steps in Enabling Developer Mode on a device to turn on Developer Mode.
Open Settings, and navigate to Developer > Performance Trace.
Turn on Performance Trace, and follow any on-device prompts.
Change the tracing mode to Power Profiler.
Tap the switch next to your app’s name in the list of monitored apps to turn on tracing for your app. If you don’t turn on tracing for any apps, Performance Trace only records overall system power metrics.
Swipe down from the top-right of the screen to open Control Center.
Tap the Add button (+).
Tap Add a Control.
Choose the Performance Trace control.
[Image]
To gather a power trace:
Open Control Center.
Tap the Performance Trace control.
Interact with your app. Performance Trace gathers data for up to 10 hours.
Tap the Performance Trace control again in Control Center to stop gathering performance data.
To send the power trace to your Mac or another developer:
Open Settings.
Navigate to Developer > Performance Trace.
Tap the Share button next to the trace file in the list of available trace files.
Share the trace file with another developer, or use AirDrop to send it to your Mac.
In Finder, double-click the *.aar file you receive to expand it into a *.atrc file that you can open in Instruments.
Make changes to reduce power usage
Combine the information from Power Profiler with data you gather using other tools to identify how your app’s features use power, and plan your performance-engineering work.
If your app uses a lot of CPU power, combine Power Profiler with the CPU Profiler, Processor Trace, or CPU Counters instruments to correlate the high power usage with the code your app runs and identify functions to make more efficient. For more information, see Analyzing CPU usage with the Processor Trace instrument and Addressing CPU bottlenecks.
If your app uses a lot of GPU power, use the Metal debugger to identify opportunities to make your app’s GPU usage more efficient. For more information, see Optimizing GPU performance.
If your app uses a lot of display power, consider adapting your app’s UI to reduce its average pixel luminance. For example, make sure your app supports the dark appearance. For more information, see Supporting Dark Mode in your interface.
If your app uses a lot of networking power, combine Power Profiler with the Network Connections and HTTP Traffic instruments to correlate the high power usage with the network requests your app makes, and identify strategies to reduce the frequency of network connections or the amount of data the app transfers. For more information, see Analyzing HTTP traffic with Instruments.
After you make a change, use Power Profiler again to validate that your change improves your app’s power usage. Consider capturing multiple recordings before and after the change, as the device’s state and other external factors can affect the specific values recorded for each metric.