BatteryStats计算电量
2018-09-18 18:03:02 0 举报
Android BatteryStats 计算电量流程以及计算公式
作者其他创作
大纲/内容
idlePower = (idleTimeMs * cpuIdlePower) / (60* 60* 1000)
addBluetoothUsage:蓝牙硬件耗电量以及所有App使用wifi的功耗总和DrainType.BLUETOOTH
mUserSippers
addScreenUsage:屏幕耗电量(各个级别背光的耗电总和)DrainType.SCREEN
bluetoothPowerMah = ((idleTimeMs * mIdleMa) + (rxTimeMs * mRxMa) + (txTimeMs * mTxMa)) / (1000 * 60 * 60);
addIdleUsage:Cpu处于Suspend和idle状态的总耗电量DrainType.IDLE
mUsageList
Process.WIFI_UID
uidStats
mBluetoothSippers
addUserUsage:各个用户的耗电量DrainType.USER
addWiFiUsage:wifi的硬件功耗以及所有App使用wifi的功耗总和DrainType.WIFI
refreshStats:processAppUsage()mMobilemsppList.add(bs);processMiscUsage()
user_power = user_1_power + user_2_power + … + user_n_power; (n为所有的user的总数)
processMiscUsage:计算硬件耗电addUserUsage();addPhoneUsage();addScreenUsage();addWiFiUsage();addBluetoothUsage();addMemoryUsage();addIdleUsage();addRadioUsage();
screen_power = screenOnTimeMs * screenOnPower + backlight_powerbacklight_power = 0.1 * dark_brightness_time * screenFullPower + 0.3 * dim_brightness_time * screenFullPower + 0.5 * medium_brightness_time * screenFullPower + 0.7 * light_brightness_time + 0.9 * bright_brightness_time * screenFullPower;
wifiPowerMah = powerDrainMah - mTotalAppPowerDrain;powerDrainMah = ((idleTimeMs * mIdleCurrentMa) + (txTimeMs * mTxCurrentMa) +(rxTimeMs * mRxCurrentMa);
addPhoneUsage:通话信号处于活跃时的耗电和DrainType.PHONE
mWifiSippers
mem_powers = (mAatRail * timeMs) / (60* 1000)
addRadioUsage:Radio Cell信号(非通话)处于各个级别上的总耗电量DrainType.CELL
app.getUid() == ?
phone_powers = (phoneOnTimeMs * phoneOnPower) / (60* 60* 1000)
循环mUidStats 的List
processAppUsage:计算软件耗电uidStats = mStats.getUidStats()
mobileRadioPowerMah = strengthOnPower + scanningPower + remainingActivePowerstrengthOnPower = none_strength_Ms * none_strength_Power + poor_strength_Ms * poor_strength_Power + moderate_strength_Ms * moderate_strength_Power + good_strength_Ms * good_strength_Power + great_strength_Ms * great_strength_Power;scanningPower = scanningTimeMs * mPowerScan;remainingActivePower = (radioActiveTimeMs - mTotalAppMobileActiveMs)* mPowerRadioOn;
mMobilemsppList
addMemoryUsage:DDR内存硬件的耗电量DrainType.MEMORY
Process.BLUETOOTH_UID
收藏
0 条评论
下一页