dumpsys batterystats

24 篇文章 4 订阅
18 篇文章 1 订阅
 使用batterystats可了解系统中wakelock的详细持有时间,有助于power和sleep调试。关注一下。

http://blog.csdn.net/oujunli/article/details/37563067
http://www.2cto.com/kf/201510/445482.html


dumpsys batterystats --enable full-wake-history
dumpsys batterystats --reset
dumpsys batterystats > batterystats.txt


shell@sofia3gr:/ # dumpsys batterystats --help
Unknown option: --help
Battery stats (batterystats) dump options:
  [--checkin] [--history] [--history-start] [--unplugged] [--charged] [-c]
  [--reset] [--write] [-h] [<package.name>]
  --checkin: format output for a checkin report.
  --history: show only history data.
  --history-start <num>: show only history data starting at given time offset.
  --unplugged: only output data since last unplugged.
  --charged: only output data since last charged.
  --reset: reset the stats, clearing all current data.
  --write: force write current collected stats to disk.
  <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 and proc events
      no-auto-reset: don't automatically reset stats when unplugged








shell@sofia3gr:/ # dumpsys batterystats                                        
Battery History (0% used, 576 used of 256KB, 35 strings using 1958):
                    0 (9) RESET:TIME: 2000-01-01-08-30-06
                    0 (2) 069 status=charging health=good plug=usb temp=0 volt=4282 +running +phone_scanning +plugged phone_state=out proc=u0a3:"android.process.acore"
                    0 (2) 069 proc=1000:"com.intel.thermal"
                    0 (2) 069 proc=u0a21:"com.android.calendar"
                    0 (2) 069 proc=u0a5:"com.android.dialer"
                    0 (2) 069 proc=u0a51:"com.intel.soundprofile"
                    0 (2) 069 proc=u0a44:"com.android.printspooler"
                    0 (2) 069 proc=u0a12:"com.android.onetimeinitializer"
                    0 (2) 069 proc=u0a54:"com.android.smspush"
                    0 (2) 069 proc=u0a33:"com.android.inputmethod.latin"
                    0 (2) 069 proc=1000:"com.intel.crashreport"
                    0 (2) 069 proc=u0a47:"android.rockchip.update.service"
                    0 (2) 069 proc=u0a3:"com.android.contacts"
                    0 (2) 069 proc=u0a8:"com.android.launcher3"
                    0 (2) 069 proc=1000:"com.cghs.stresstest"
                    0 (2) 069 proc=1000:"com.DeviceTest"
                    0 (2) 069 proc=u0a28:"com.android.exchange"
                    0 (2) 069 proc=u0a25:"com.android.deskclock"
                    0 (2) 069 proc=u0a27:"com.android.email"
                    0 (2) 069 proc=1000:"com.android.settings"
                    0 (2) 069 proc=u0a9:"com.android.managedprovisioning"
                    0 (2) 069 proc=u0a6:"android.process.media"
                    0 (2) 069 proc=u0a15:"com.android.systemui"
                    0 (2) 069 proc=1000:"com.android.schpwronoff"
                    0 (2) 069 proc=1001:"com.android.phone"
                    0 (2) 069 proc=u0a1:"com.android.providers.calendar"
                    0 (2) 069 proc=u0a11:"com.android.musicfx"
                    0 (2) 069 proc=u0a10:"com.android.mms"
                    0 (2) 069 top=u0a8:"com.android.launcher3"
                    0 (2) 069 user=0:"0"
                    0 (2) 069 userfg=0:"0"
             +7s623ms (2) 070
            +20s226ms (5) 070 status=not-charging plug=none volt=3949 +wake_lock=-1:"screen" +screen -plugged brightness=medium +wake_lock_in=-1:"screen"
            +20s283ms (2) 070 +wake_lock_in=1001:"RILJ"
            +20s293ms (2) 070 -wake_lock_in=1001:"RILJ"
            +20s298ms (2) 070 +wake_lock_in=1001:"RILJ"
            +20s305ms (2) 070 -wake_lock_in=1001:"RILJ"
            +25s752ms (2) 070 +wake_lock_in=1000:"*alarm*:android.net.ConnectivityService.action.PKT_CNT_SAMPLE_INTERVAL_ELAPSED"
            +25s769ms (2) 070 +wake_lock_in=1000:"NetworkStats"
            +25s778ms (2) 070 -wake_lock_in=1000:"NetworkStats"
            +25s784ms (2) 070 -wake_lock_in=1000:"*alarm*:android.net.ConnectivityService.action.PKT_CNT_SAMPLE_INTERVAL_ELAPSED"
            +28s261ms (2) 070 brightness=dark
            +30s278ms (2) 070 +wake_lock_in=1000:"WifiSuspend"
            +30s286ms (3) 070 -screen -wake_lock_in=1000:"WifiSuspend"
            +30s816ms (2) 070 -wake_lock -wake_lock_in=-1:"screen"
            +30s828ms (3) 070 +wake_lock=1001:"RILJ" +wake_lock_in=1001:"RILJ"
            +30s836ms (2) 070 -running -wake_lock -wake_lock_in=1001:"RILJ"
          +1m28s238ms (2) 070 +running wake_reason=0:"69:"
          +1m28s563ms (5) 070 status=charging plug=usb volt=4319 +wake_lock=-1:"screen" +screen +plugged brightness=medium +wake_lock_in=-1:"screen"
          +1m28s603ms (2) 070 +wake_lock_in=1001:"RILJ"
          +1m28s614ms (2) 070 -wake_lock_in=1001:"RILJ"
          +1m28s616ms (2) 070 +wake_lock_in=1001:"RILJ"
          +1m28s631ms (2) 070 -wake_lock_in=1001:"RILJ"
          +1m28s653ms (2) 070 +wake_lock_in=1000:"*alarm*:android.intent.action.TIME_TICK"
          +1m28s881ms (2) 070 -wake_lock_in=1000:"*alarm*:android.intent.action.TIME_TICK"
          +1m36s590ms (2) 070 brightness=dark
          +1m38s611ms (2) 070 +wake_lock_in=1000:"WifiSuspend"
          +1m38s626ms (3) 070 -screen -wake_lock_in=1000:"WifiSuspend"
          +1m39s139ms (2) 070 -wake_lock -wake_lock_in=-1:"screen"
          +1m39s152ms (3) 070 +wake_lock=1001:"RILJ" +wake_lock_in=1001:"RILJ"
          +1m39s162ms (2) 070 -wake_lock -wake_lock_in=1001:"RILJ"
          +1m39s163ms (3) 070 +wake_lock=1001:"RILJ" +wake_lock_in=1001:"RILJ"
          +1m39s173ms (2) 070 -wake_lock -wake_lock_in=1001:"RILJ"


Per-PID Stats:
  PID 555 wake time: +283ms
  PID 877 wake time: +79ms


Statistics since last charge:
  System starts: 0, currently on battery: false
  Time on battery: 1m 8s 337ms (58.0%) realtime, 11s 469ms (9.7%) uptime
  Time on battery screen off: 57s 779ms (49.1%) realtime, 911ms (0.8%) uptime
  Total run time: 1m 57s 764ms realtime, 1m 0s 897ms uptime
  Start clock time: 2000-01-01-08-30-05
  Screen on: 10s 558ms (15.4%) 1x, Interactive: 10s 3ms (14.6%)
  Screen brightnesses:
    dark 2s 562ms (24.3%)
    medium 7s 996ms (75.7%)
  Total partial wakelock time: 12ms
  Mobile total received: 0B, sent: 0B (packets received 0, sent 0)
  Phone signal levels:
    none 1m 8s 337ms (100.0%) 0x
  Signal scanning time: 1m 8s 337ms
  Radio types: (no activity)
  Mobile radio active time: 0ms (0.0%) 0x
  Wi-Fi total received: 0B, sent: 0B (packets received 0, sent 0)
  Wifi on: 0ms (0.0%), Wifi running: 0ms (0.0%)
  Wifi states: (no activity)
  Wifi supplicant states: (no activity)
  Wifi signal levels: (no activity)
  Bluetooth on: 0ms (0.0%)
  Bluetooth states: (no activity)


  Device battery use since last full charge
    Amount discharged (lower bound): 0
    Amount discharged (upper bound): 0
    Amount discharged while screen on: 0
    Amount discharged while screen off: 0


  Estimated power use (mAh):
    Capacity: 6700, Computed drain: 2.75, actual drain: 0.00000000
    Cell standby: 1.63
    Screen: 0.971
    Idle: 0.112
    Uid 1000: 0.0311
    Uid 0: 0.00803
    Uid u0a15: 0.00285
    Uid 1001: 0.00156
    Uid u0a8: 0.000521
    Uid u0a10: 0.000260
    Uid u0a47: 0.000260


  All kernel wake locks:
  Kernel Wake lock intel_otg   : 471ms (1 times) realtime
  Kernel Wake lock AG620_THERMAL_PROT_LOCK: 434ms (1 times) realtime
  Kernel Wake lock mmc_delayed_work: 334ms (1 times) realtime
  Kernel Wake lock alarm       : 243ms (1 times) realtime
  Kernel Wake lock PowerManagerService.Display: 159ms (1 times) realtime
  Kernel Wake lock chrg_wake_lock: 89ms (1 times) realtime
  Kernel Wake lock swfg_kfifo_wakelock: 81ms (1 times) realtime
  Kernel Wake lock NETLINK     : 30ms (6 times) realtime
  Kernel Wake lock adc_meas_lock: 30ms (5 times) realtime
  Kernel Wake lock PowerManagerService.WakeLocks: 12ms (1 times) realtime
  Kernel Wake lock chrg_det    : 11ms (1 times) realtime
  Kernel Wake lock PowerManagerService.Broadcasts: 2ms (1 times) realtime
  Kernel Wake lock sw_fuel_gauge_hal_wake_lock: 1ms (2 times) realtime


  All partial wake locks:
  Wake lock 1001 RILJ: 12ms (1 times) realtime


  All wakeup reasons:
  Wakeup reason 69: realtime


  0:
    Proc cfinteractive:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc ueventd:
      CPU: 0ms usr + 40ms krn ; 0ms fg
    Proc fb-vsync:
      CPU: 0ms usr + 60ms krn ; 0ms fg
    Proc ksmd:
      CPU: 0ms usr + 50ms krn ; 0ms fg
    Proc lmkd:
      CPU: 0ms usr + 20ms krn ; 0ms fg
    Proc logd:
      CPU: 30ms usr + 20ms krn ; 0ms fg
    Proc netd:
      CPU: 10ms usr + 0ms krn ; 0ms fg
    Proc vold:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc rcu_preempt:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc kworker/0:3:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc kworker/2:0:
      CPU: 0ms usr + 20ms krn ; 0ms fg
    Proc healthd:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc mmcqd/0:
      CPU: 0ms usr + 10ms krn ; 0ms fg
  1000:
    User activity: 2 other
    Wake lock NetworkStats realtime
    Wake lock *alarm* realtime
    Wake lock WifiSuspend realtime
    Sensor 0: 9s 990ms realtime (1 times)
    Foreground for: 1m 8s 337ms 
    Proc com.intel.thermal:
      CPU: 10ms usr + 0ms krn ; 0ms fg
    Proc system:
      CPU: 270ms usr + 440ms krn ; 0ms fg
    Proc surfaceflinger:
      CPU: 20ms usr + 430ms krn ; 0ms fg
    Proc servicemanager:
      CPU: 0ms usr + 10ms krn ; 0ms fg
  1001:
    Wake lock RILJ: 12ms partial (1 times) realtime
    Foreground for: 1m 8s 337ms 
    Proc rild:
      CPU: 20ms usr + 0ms krn ; 0ms fg
    Proc com.android.phone:
      CPU: 40ms usr + 0ms krn ; 0ms fg
  u0a1:
    Running for: 1m 8s 337ms 
  u0a2:
    Foreground for: 1m 8s 337ms 
  u0a3:
    Active for: 1m 8s 337ms 
  u0a5:
    Running for: 1m 8s 337ms 
  u0a6:
    Active for: 190ms 
    Running for: 1m 8s 337ms 
    Apk com.android.providers.media:
      Service com.android.providers.media.MtpService:
        Created for: 87ms uptime
        Starts: 1, launches: 1
  u0a8:
    Foreground for: 1m 8s 337ms 
    Proc com.android.launcher3:
      CPU: 10ms usr + 10ms krn ; 0ms fg
  u0a9:
    Running for: 1m 8s 337ms 
  u0a10:
    Running for: 1m 8s 337ms 
    Proc com.android.mms:
      CPU: 0ms usr + 10ms krn ; 0ms fg
  u0a11:
    Running for: 1m 8s 337ms 
  u0a12:
    Running for: 1m 8s 337ms 
  u0a15:
    Foreground for: 1m 8s 337ms 
    Proc com.android.systemui:
      CPU: 80ms usr + 30ms krn ; 0ms fg
  u0a21:
    Running for: 1m 8s 337ms 
  u0a25:
    Running for: 1m 8s 337ms 
  u0a27:
    Running for: 1m 8s 337ms 
  u0a28:
    Active for: 1m 8s 337ms 
  u0a33:
    Active for: 1m 8s 337ms 
  u0a36:
    Foreground for: 1m 8s 337ms 
  u0a44:
    Running for: 1m 8s 337ms 
  u0a47:
    Active for: 1m 8s 337ms 
    Proc android.rockchip.update.service:
      CPU: 10ms usr + 0ms krn ; 0ms fg
  u0a51:
    Foreground for: 1m 8s 337ms 
  u0a54:
    Foreground for: 1m 8s 337ms 


Statistics since last unplugged:
  Time on battery: 1m 8s 337ms (69.8%) realtime, 11s 469ms (11.7%) uptime
  Time on battery screen off: 57s 747ms (59.0%) realtime, 879ms (0.9%) uptime
  Total run time: 1m 37s 899ms realtime, 41s 32ms uptime
  Start clock time: 2000-01-01-08-30-05
  Screen on: 10s 558ms (15.4%) 1x, Interactive: 10s 3ms (14.6%)
  Screen brightnesses:
    dark 2s 562ms (24.3%)
    medium 7s 996ms (75.7%)
  Total partial wakelock time: 12ms
  Mobile total received: 0B, sent: 0B (packets received 0, sent 0)
  Phone signal levels:
    none 1m 8s 337ms (100.0%) 0x
  Signal scanning time: 1m 8s 337ms
  Radio types: (no activity)
  Mobile radio active time: 0ms (0.0%) 0x
  Wi-Fi total received: 0B, sent: 0B (packets received 0, sent 0)
  Wifi on: 0ms (0.0%), Wifi running: 0ms (0.0%)
  Wifi states: (no activity)
  Wifi supplicant states: (no activity)
  Wifi signal levels: (no activity)
  Bluetooth on: 0ms (0.0%)
  Bluetooth states: (no activity)


  Device is currently plugged into power
    Last discharge cycle start level: 70
    Last discharge cycle end level: 70
    Amount discharged while screen on: 0
    Amount discharged while screen off: 0
 
  Estimated power use (mAh):
    Capacity: 6700, Computed drain: 2.75, actual drain: 0.00000000
    Cell standby: 1.63
    Screen: 0.971
    Idle: 0.112
    Uid 1000: 0.0311
    Uid 0: 0.00803
    Uid u0a15: 0.00285
    Uid 1001: 0.00156
    Uid u0a8: 0.000521
    Uid u0a10: 0.000260
    Uid u0a47: 0.000260


  All kernel wake locks:
  Kernel Wake lock intel_otg   : 443ms (1 times) realtime
  Kernel Wake lock AG620_THERMAL_PROT_LOCK: 434ms (1 times) realtime
  Kernel Wake lock mmc_delayed_work: 334ms (1 times) realtime
  Kernel Wake lock alarm       : 243ms (1 times) realtime
  Kernel Wake lock PowerManagerService.Display: 158ms (0 times) realtime
  Kernel Wake lock chrg_wake_lock: 89ms (1 times) realtime
  Kernel Wake lock swfg_kfifo_wakelock: 81ms (1 times) realtime
  Kernel Wake lock NETLINK     : 30ms (6 times) realtime
  Kernel Wake lock adc_meas_lock: 30ms (5 times) realtime
  Kernel Wake lock PowerManagerService.WakeLocks: 12ms (1 times) realtime
  Kernel Wake lock chrg_det    : 11ms (1 times) realtime
  Kernel Wake lock sw_fuel_gauge_hal_wake_lock: 1ms (2 times) realtime


  All partial wake locks:
  Wake lock 1001 RILJ: 12ms (1 times) realtime


  All wakeup reasons:
  Wakeup reason 69: realtime


  0:
    Proc cfinteractive:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc ueventd:
      CPU: 0ms usr + 40ms krn ; 0ms fg
    Proc fb-vsync:
      CPU: 0ms usr + 60ms krn ; 0ms fg
    Proc ksmd:
      CPU: 0ms usr + 50ms krn ; 0ms fg
    Proc lmkd:
      CPU: 0ms usr + 20ms krn ; 0ms fg
    Proc logd:
      CPU: 30ms usr + 20ms krn ; 0ms fg
    Proc netd:
      CPU: 10ms usr + 0ms krn ; 0ms fg
    Proc vold:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc rcu_preempt:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc kworker/0:3:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc kworker/2:0:
      CPU: 0ms usr + 20ms krn ; 0ms fg
    Proc healthd:
      CPU: 0ms usr + 10ms krn ; 0ms fg
    Proc mmcqd/0:
      CPU: 0ms usr + 10ms krn ; 0ms fg
  1000:
    User activity: 2 other
    Wake lock NetworkStats realtime
    Wake lock *alarm* realtime
    Wake lock WifiSuspend realtime
    Sensor 0: 9s 990ms realtime (1 times)
    Foreground for: 1m 8s 337ms 
    Proc com.intel.thermal:
      CPU: 10ms usr + 0ms krn ; 0ms fg
    Proc system:
      CPU: 270ms usr + 440ms krn ; 0ms fg
    Proc surfaceflinger:
      CPU: 20ms usr + 430ms krn ; 0ms fg
    Proc servicemanager:
      CPU: 0ms usr + 10ms krn ; 0ms fg
  1001:
    Wake lock RILJ: 12ms partial (1 times) realtime
    Foreground for: 1m 8s 337ms 
    Proc rild:
      CPU: 20ms usr + 0ms krn ; 0ms fg
    Proc com.android.phone:
      CPU: 40ms usr + 0ms krn ; 0ms fg
  u0a1:
    Running for: 1m 8s 337ms 
  u0a2:
    Foreground for: 1m 8s 337ms 
  u0a3:
    Active for: 1m 8s 337ms 
  u0a5:
    Running for: 1m 8s 337ms 
  u0a6:
    Active for: 190ms 
    Running for: 1m 8s 337ms 
    Apk com.android.providers.media:
      Service com.android.providers.media.MtpService:
        Created for: 87ms uptime
        Starts: 1, launches: 1
  u0a8:
    Foreground for: 1m 8s 337ms 
    Proc com.android.launcher3:
      CPU: 10ms usr + 10ms krn ; 0ms fg
  u0a9:
    Running for: 1m 8s 337ms 
  u0a10:
    Running for: 1m 8s 337ms 
    Proc com.android.mms:
      CPU: 0ms usr + 10ms krn ; 0ms fg
  u0a11:
    Running for: 1m 8s 337ms 
  u0a12:
    Running for: 1m 8s 337ms 
  u0a15:
    Foreground for: 1m 8s 337ms 
    Proc com.android.systemui:
      CPU: 80ms usr + 30ms krn ; 0ms fg
  u0a21:
    Running for: 1m 8s 337ms 
  u0a25:
    Running for: 1m 8s 337ms 
  u0a27:
    Running for: 1m 8s 337ms 
  u0a28:
    Active for: 1m 8s 337ms 
  u0a33:
    Active for: 1m 8s 337ms 
  u0a36:
    Foreground for: 1m 8s 337ms 
  u0a44:
    Running for: 1m 8s 337ms 
  u0a47:
    Active for: 1m 8s 337ms 
    Proc android.rockchip.update.service:
      CPU: 10ms usr + 0ms krn ; 0ms fg
  u0a51:
    Foreground for: 1m 8s 337ms 
  u0a54:
    Foreground for: 1m 8s 337ms 
shell@sofia3gr:/ # 




android/frameworks/base/core/java/android/os/BatteryStats.java
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值