All users suffer from the draining of the life of their mobile phone's battery during usage. What a frustrating moment when you see your phone is about to die and you don't have access to any power supply. Developers, your device, and the operating system are all involved in taking care of the battery life. Any inefficient way of performing a task in the app may cause an impact on the battery life and needs your intervention to do it in a better way. In this recipe, we will see how to measure the app energy usage from Instruments.
Pick any Xcode project you have, and click on Profile.
Choose Energy Log from the following list of instruments:
Choose the device/simulator and the app from the target device and process list.
Click on the Record button at the top-left corner.
Use the app that you want to record normally, and then click on the Stop button.
You should see a detailed analysis of the energy used:
There is another way to log the energy usage while...