Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to benchmark iPhone app's battery usage?

What's the best way to benchmark an iPhone app's battery usage?

I'm working on an iPhone app that uses location services and runs in the background. It seems like the battery drains significantly faster with it running, but when I try to do some structured tests, the results are inconclusive.

The steps I'm taking are:

  1. charge the battery to 100%
  2. remove the SIM (I need it for my other phone)
  3. turn off push for mail/calendar/contacts
  4. reinstall the app
  5. restart the phone
  6. start the app
  7. return to SpringBoard (the app selection screen)

I then wait for about 15 hours and see what the battery is at. The results so far are:

  • App not running - 69% left
  • App running - 65% left
  • App running - 83% left
like image 921
Dean Avatar asked Oct 16 '25 04:10

Dean


2 Answers

Turns out the answer is to use Apple's Measure Energy Impact in Xcode.

The info it provides really helped track down what was causing our battery draining issue.

In retrospect, I should have said that I was completely new to iOS, and was not a developer (working on the app as QA).

like image 58
Dean Avatar answered Oct 17 '25 17:10

Dean


Doesn't that just tell you that there's not a high correlation between battery usage and your app running? It looks like there's something else that's causing battery drain?

(Watch out though, that something else might be the number of gps satellites passing at the time - the faster it gets GPS, the less battery usage your app will consume - you might have to take a look at how much time your app actually spends running vs sleeping for each test)

like image 43
deanWombourne Avatar answered Oct 17 '25 17:10

deanWombourne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!