Complete energy optimization API reference - Power Profiler workflows, timer/network/location/background APIs, iOS 26 BGContinuedProcessingTask, MetricKit monitoring, with all WWDC code examples
View on GitHubSelect agents to install to:
npx add-skill https://github.com/CharlesWiltgen/Axiom/blob/main/.claude-plugin/plugins/axiom/skills/axiom-energy-ref/SKILL.md -a claude-code --skill axiom-energy-refInstallation paths:
.claude/skills/axiom-energy-ref/# Energy Optimization Reference Complete API reference for iOS energy optimization, with code examples from WWDC sessions and Apple documentation. **Related skills**: `axiom-energy` (decision trees, patterns), `axiom-energy-diag` (troubleshooting) --- ## Part 1: Power Profiler Workflow ### Recording a Trace with Instruments #### Tethered Recording (Connected to Mac) ``` 1. Connect iPhone wirelessly to Xcode - Xcode → Window → Devices and Simulators - Enable "Connect via network" for your device 2. Profile your app - Xcode → Product → Profile (Cmd+I) - Select Blank template - Click "+" → Add "Power Profiler" - Optionally add "CPU Profiler" for correlation 3. Record - Select your app from target dropdown - Click Record (red button) - Use app normally for 2-3 minutes - Click Stop 4. Analyze - Expand Power Profiler track - Examine per-app lanes: CPU, GPU, Display, Network ``` **Important**: Use wireless debugging. When device is charging via cable, system power usage shows 0. #### On-Device Recording (Without Mac) From WWDC25-226: Capture traces in real-world conditions. ``` 1. Enable Developer Mode Settings → Privacy & Security → Developer Mode → Enable 2. Enable Performance Trace Settings → Developer → Performance Trace → Enable Set tracing mode to "Power Profiler" Toggle ON your app in the app list 3. Add Control Center shortcut Control Center → Tap "+" → Add a Control → Performance Trace 4. Record Swipe down → Tap Performance Trace icon → Start Use app (can record up to 10 hours) Tap Performance Trace icon → Stop 5. Share trace Settings → Developer → Performance Trace Tap Share button next to trace file AirDrop to Mac or email to developer ``` ### Interpreting Power Profiler Metrics | Lane | Meaning | What High Values Indicate | |------|---------|--------------------------| | System Power | Overall battery drain rate | General energy consumption | | CPU Power Impact | Processor