Battery-Historian基本参数介绍


Battery-Historian是谷歌推出的一款专门分析Bugreport的工具,是谷歌2015年I/O大会上推出的一款检测运行在android5.0(Lollipop)及以后版本的设备上电池的相关信息和事件的工具,是一款对于分析手机状态,历史运行情况很好的可视化分析工具,当设备在使用电池的时候,它可以使用开发者们看到系统级和应用级事件图表,在图表时间轴上可以缩放和平移,能够直观的看到自上一次充满电到现在设备电池的统计汇总信息,它可以选中一个应用程序来检查该应用影响电池电量的一些参数,并且可以对比两个bugreport文件信息分析,并对其电池关键区别点做高亮显示。


下面我们就battery-historian分析结果的分析做一些简单的介绍


将bugreport提交后battery-historian会自动进行分析,下面是分析结果页面最主要的内容:


1. 上图横坐标是时间轴,上图的7:15  7:30就是时间,说明时间间隔是15分钟,当然可以通过鼠标滚轮去放大和缩小时间间隔

2. 纵轴

1)CPU running

CPU的运行状态,黑色是running状态,空白表示CPU处于空闲状态。

 2)Kernel only uptime

kernel运行时间,kernel wakelockuserspace wakelock都有可能阻止系统睡眠

 3)Userspace wakelock

代表应用持有wakelock锁的总时间,但是不会精确到某个app持有wakelock的时间。

kernel wakelockuserspace wakelock都有可能阻止系统睡眠

4) Long Wakelocks

Wakelocks are currently logged as being held for a long time if they have been held for more than a minute.

The time shown here is the total amount of the wakelock was held.

5)Screen

屏幕状态,红色:亮屏,空白:灭屏。

 6)Top app

当前时刻当前运行的是那个应用,可以用来判断某一个app对于整体手机电量的影响。

7)Activity Manager Proc

activity的进程信息,包括该进程的开始时间和结束时间。

8)Doze

Doze模式的状态

9)JobScheduler

JobScheduler是Android L版本新引入的API,JobScheduler,顾名思义,是用来调度工作。工作被调度的条件包括网络变化,充电插拔,周期执行等。使用场景包括wifi条件下数据下载上传等等。

10)GPS

GPS的使用情况,红色:使用,空白:闲置。

11)Network connectivity

点击可以查看各个颜色代表的不同含义。

12)Mobile signal strength

移动信号,绿色:great,黄色:good,橘色:moderate,红色:poor,空白:none。

 13)Wifi scan

Wifi扫描状态,绿色:在扫描,空白:没有扫描。

14)Wifi supplicant

无线客户端,底层的一个demo,在wifi运行的时候,这个也会运行。

 15)Wifi signal strength

Wifi信号强度,绿色:great,黄色:good,橘色:moderate,红色:poor,空白:none。

 16)Wifi running

wifi运行状态

 17)Wifi on

wifi是否开启

 18)Package install

安装软件是的状态信息。

 19)Battery level

电池电量水平

 20)Plugged

插入充电器的时段

 21)Charging on

充电时段

 22)Temperature

电池温度


下面是官网上的一些信息



  • battery_level: When the battery level was recorded and logged. Reported in percent, where 093 is 93%. Provides an overall measure of how fast the battery is draining.
  • top: The application running at the top; usually, the application that is visible to the user. If you want to measure battery drain while your app is active, make sure it's the top app. If you want to measure battery drain while your app is in the background, make sure it's not the top app.
  • wifi_running: Shows that the Wi-Fi network connection was active.
  • screen: Screen is turned on.
  • phone_in_call: Recorded when the phone is in a call.
  • wake_lock: App wakes up, grabs a lock, does small work, then goes back to sleep. This is one of the most important pieces of information. Waking up the phone is expensive, so if you see lots of short bars here, that might be a problem.
  • running: Shows when the CPU is awake. Check whether it is awake and asleep when you expect it to be.
  • wake_reason: The last thing that caused the kernel to wake up. If it's your app, determine whether it was necessary.
  • mobile_radio: Shows when the radio was on. Starting the radio is battery expensive. Many narrow bars close to each other can indicate opportunities for batching and other optimizations.
  • gps: Indicates when the GPS was on. Make sure this is what you expect.
  • sync: Shows when an app was syncing with a backend. The sync bar also shows which app did the syncing. For users, this can show apps where they might turn syncing off to save battery. Developers should sync as little as possible and only as often as necessary.

Note: Not every chart will show every category.




  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Battery Historian是一个用于分析Android设备电池使用情况的工具,下面是搭建方法: 1. 安装并配置Python环境:Battery Historian是基于Python开发的,首先需要安装Python环境。可以从Python官方网站下载最新版本的Python并进行安装,在安装过程中记得勾选"Add Python to PATH"选项。完成安装后,打开命令提示符窗口,输入"python --version"来确认Python是否安装成功,并且能够显示相应的版本号。 2. 下载Battery Historian代码:在Battery Historian的GitHub仓库中,找到并下载最新版本的代码。可以直接在浏览器中访问"https://github.com/google/battery-historian",然后点击"Clone or download"按钮进行下载。下载完成后,将代码解压到合适的目录中。 3. 安装必要的依赖库:在命令提示符窗口中切换到Battery Historian代码所在的目录,并使用pip install命令来安装必要的依赖库。例如,可以执行"pip install -r requirements.txt"命令来安装所有需要的依赖库。 4. 运行Battery Historian:在命令提示符窗口中切换到Battery Historian代码所在的目录,并执行"python historian.py"命令来启动Battery Historian。启动成功后,命令提示符窗口会显示"Running on"的信息,表示Battery Historian已成功运行。此时,可以在浏览器中输入"http://localhost:9999"来访问Battery Historian的Web界面,并开始分析Android设备的电池使用情况。 以上就是使用Battery Historian的搭建方法。需要注意的是,Battery Historian只能分析Android设备的电池使用情况,因此在使用之前,需要将Android设备连接到电脑上,并确保设备已开启开发者选项,并开启USB调试模式。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值