电量优化中-电量监控和分析工具

18 篇文章 0 订阅

电量监控和分析工具

Android 5.0开始 提供了电量获取和分析的方式

一、使用adb 命令 dumpsys batteryst 生成电池的使用情况

二、使用Battery Historian 分析耗电情况

当然上述方式是耗电相对测试,如果需要精确测量并且是测量政绩耗电,可以使用稳定的电源加上电流仪 进行精确测量,当然这种方式比较麻烦,而且条件比较苛刻,不适合应用开发人员使用。

下面给出 adb shell dumpsys batterystats 常用参数(由:adb shell dumpsys batterystats -h 命令生成)

Battery stats (batterystats) dump options:
  [--checkin] [--proto] [--history] [--history-start] [--charged] [-c]
  [--daily] [--reset] [--write] [--new-daily] [--read-daily] [-h] [<package.name>]
  --checkin: generate output for a checkin report; will write (and clear) the
             last old completed stats when they had been reset.
  -c: write the current stats in checkin format.
  --proto: write the current aggregate stats (without history) in proto format.
  --history: show only history data.
  --history-start <num>: show only history data starting at given time offset.
  --history-create-events <num>: create <num> of battery history events.
  --charged: only output data since last charged.
  --daily: only output full daily data.
  --reset: reset the stats, clearing all current data.
  --write: force write current collected stats to disk.
  --new-daily: immediately create and write new daily stats record.
  --read-daily: read-load last written daily stats.
  --settings: dump the settings key/values related to batterystats
  --cpu: dump cpu stats for debugging purpose
  <package.name>: optional name of package to filter output by.
  -h: print this help text.
Battery stats (batterystats) commands:
  enable|disable <option>
    Enable or disable a running option.  Option state is not saved across boots.
    Options are:
      full-history: include additional detailed events in battery history:
          wake_lock_in, alarms and proc events
      no-auto-reset: don't automatically reset stats when unplugged
      pretend-screen-off: pretend the screen is off, even if screen state changes

Battery Historian :

官方安装和说明

Battery Historian Github地址

Docker 以及当前下载好的Mac班的软件 地址:下载

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值