衡量 iPhone 应用程序电池使用情况的最佳方法是什么?
对 iPhone 应用程序的电池使用情况进行基准测试的最佳方法是什么?
我正在开发一个使用位置服务并在后台运行的 iPhone 应用程序。 似乎运行时电池消耗速度明显加快,但当我尝试进行一些结构化测试时,结果并不确定。
我正在采取的步骤是:
- 将电池充电至 100%
- 取出 SIM 卡(我的其他手机需要它)
- 关闭邮件/日历/联系人推送
- 重新安装应用程序 重新
- 启动手机 启动
- 应用程序
- 返回 SpringBoard(该应用程序选择屏幕)
然后我等待大约 15 小时,看看电池电量如何。到目前为止的结果是:
- 应用程序未运行 - 剩余 69%
- 应用程序正在运行 - 剩余 65%
- 应用程序正在运行 - 剩余 83%
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:
- charge the battery to 100%
- remove the SIM (I need it for my other phone)
- turn off push for mail/calendar/contacts
- reinstall the app
- restart the phone
- start the app
- 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,答案是使用 Apple 的测量能源影响< /a> 在 Xcode 中。
它提供的信息确实有助于找出导致电池耗尽问题的原因。
回想起来,我应该说我对 iOS 完全陌生,并且不是开发人员(作为 QA 从事应用程序工作)。
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).
这难道不只是告诉您电池使用情况和应用程序运行之间没有很高的相关性吗?看来还有其他原因导致电池耗尽?
(但请注意,其他因素可能是当时经过的 GPS 卫星的数量 - 获取 GPS 的速度越快,您的应用程序消耗的电池使用量就越少 - 您可能需要查看您的应用程序实际花费了多少时间每次测试时跑步与睡眠)
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)