Reputation: 2061
My app currently shows up at around top 5 in power usage under settings->Battery. On that screen it says the app spends many hours in the background. Ive tried using Instruments however the analytics provided are not enough to draw any meaningful conclusions or pinpoint any sections of code. Any suggestions how to further investigate power consumption. A tool that ties power consumption to specific source code would be the best?
Upvotes: 2
Views: 7479
Reputation: 2078
I would use Xcode Instruments - Energy Diagnostics for what your looking for.
The process is - Open instruments and load the "Energy Diagnostics" template. From there, you record data in instruments and use the app. After your finished you can analyze the data.
Also, right in Xcode you can use the Energy Debug Tool now:
Debug Energy During Development
The debug navigator in Xcode includes an Energy Impact gauge, which provides a high-level overview of energy usage as you test your app. Consult this gauge regularly throughout your app’s testing cycle to assess your app’s energy impact and identify potential problem areas up-front. If necessary, dive into Instruments for more in-depth analysis.
This will give you a good starting point to diagnose, from there you may need to look and analyze deeper (Activity Monitor, File Activity, Time Profiler, etc..) in Instruments.
Here is a User Guide from Apple on how to do this in greater detail and it also shows how to analyze the data using Instruments.
Upvotes: 2