Documentation ¶
Overview ¶
Package checkinparse contains functions to parse checkin report into batterystats proto.
Index ¶
- Constants
- func CreateCheckinReport(cp *sessionpb.Checkin) *checkinutil.CheckinReport
- func ParseAppNetwork(reportVersion int32, record []string, app *bspb.BatteryStats_App) (string, []error)
- func ParseAppStateTime(record []string, app *bspb.BatteryStats_App) (string, []error)
- func ParseAppSystemPowerUseItem(pc checkinutil.Counter, record []string, app *bspb.BatteryStats_App, ...) (string, error)
- func ParseAppVibrator(record []string, app *bspb.BatteryStats_App) (string, []error)
- func ParseAppWifi(record []string, app *bspb.BatteryStats_App) (string, []error)
- func ParseBatteryStats(pc checkinutil.Counter, cr *checkinutil.CheckinReport, ...) (*bspb.BatteryStats, []string, []error)
- func ParseFloat32(s string) (float32, error)
- func ParseGlobalBluetooth(record []string, system *bspb.BatteryStats_System) (string, []error)
- func ParseGlobalWifi(record []string, system *bspb.BatteryStats_System) (string, []error)
- func ParseSlice(pc checkinutil.Counter, name string, value []string, outputs ...interface{}) ([]string, error)
- func ParseSystemMisc(pc checkinutil.Counter, reportVersion int32, record []string, ...) (string, []error)
- func SortByCount(items []*WakelockInfo)
- func SortByTime(items []*WakelockInfo)
- type WakelockInfo
Constants ¶
const ( GlobalWifiData = "gwfl" GlobalBluetoothData = "gble" )
String representations of categories the parsing code handles. Contains all categories defined in frameworks/base/core/java/android/os/BatteryStats.java unless explicitly stated.
Variables ¶
This section is empty.
Functions ¶
func CreateCheckinReport ¶
func CreateCheckinReport(cp *sessionpb.Checkin) *checkinutil.CheckinReport
CreateCheckinReport creates a checkinutil.CheckinReport from the given sessionpb.Checkin.
func ParseAppNetwork ¶
func ParseAppNetwork(reportVersion int32, record []string, app *bspb.BatteryStats_App) (string, []error)
ParseAppNetwork parses "nt" (NETWORK_DATA) into App.
record holds content from BatteryStats's networkData.
e.g., 0,0,996,1389 (reportVersion < 8) e.g., 0,0,8987,7051,0,0,25,29,0,0 (reportVersion >= 8)
If app has a Network field already, then newly found values from parsing will be added to it. The most common case of this would be when an app is installed on a device with multiple users (ie. with a work profile). In such cases, the app uid is combined with the user ID (to create UIDs such as 1010011 vs 10011) and thus the app is treated and reported separately for each profile.
func ParseAppStateTime ¶
func ParseAppStateTime(record []string, app *bspb.BatteryStats_App) (string, []error)
ParseAppStateTime parses record into app's StateTime.
record holds content from BatteryStats's stateTimeSection.
e.g., 19447364,19447364,19447364
If app has a StateTime already, then newly found values from parsing will be added to it.
func ParseAppSystemPowerUseItem ¶
func ParseAppSystemPowerUseItem(pc checkinutil.Counter, record []string, app *bspb.BatteryStats_App, system *bspb.BatteryStats_System, allAppComputedPowerMah *float32) (string, error)
ParseAppSystemPowerUseItem parses "pwi"(POWER_USE_ITEM_DATA) in App and System's PowerUseItem. We need to match raw item name with proto item name, so we parse manually. format: 8,0,u,pwi,unacc,2277 drain type, power in mAh If drain type is "uid", it's per-app data, we add power in mAh into its app proto If drain type matches other types specified in "powerUseItemNameMap", we add it to system proto. If app has a PowerUseItem already, then newly found values from parsing will be added to it. The most common case of this would be when an app is installed on a device with multiple users (ie. with a work profile). In such cases, the app uid is combined with the user ID (to create UIDs such as 1010011 vs 10011) and thus the app is treated and reported separately for each profile. TODO: we currently combine them all under the same UID. In the future, we should separate them. The sum of app consumed power will be added to system proto later.
func ParseAppVibrator ¶
func ParseAppVibrator(record []string, app *bspb.BatteryStats_App) (string, []error)
ParseAppVibrator parses record into app's Vibrator.
record holds content from BatteryStats's vibratorSection.
e.g., 14,2
If app has a Vibrator field already, then newly found values from parsing will be added to it.
func ParseAppWifi ¶
func ParseAppWifi(record []string, app *bspb.BatteryStats_App) (string, []error)
ParseAppWifi parses "wfl"(WIFI_DATA) in App. Parse manually due to unit conversion. If app has a Wifi field already, then newly found values from parsing will be added to it. format: 14,10009,l,wfl,1386709324,304313000,0,3000,1500,500 full wifi lock on time (usec), wifi scan time (usec), app wifi running time (usec), wifi idle time (msec), wifi Rx time (msec), wifi Tx time (msec)
func ParseBatteryStats ¶
func ParseBatteryStats(pc checkinutil.Counter, cr *checkinutil.CheckinReport, pkgs []*usagepb.PackageInfo) (*bspb.BatteryStats, []string, []error)
ParseBatteryStats parses the aggregated battery stats in checkin report according to frameworks/base/core/java/android/os/BatteryStats.java.
func ParseFloat32 ¶
ParseFloat32 parses an individual 32-bit float.
func ParseGlobalBluetooth ¶
func ParseGlobalBluetooth(record []string, system *bspb.BatteryStats_System) (string, []error)
ParseGlobalBluetooth parses "gble" (GLOBAL_BLUETOOTH_DATA") into system. format: 9,0,l,gble,15,16,17,18 bluetooth_idle_time_msec, bluetooth_rx_time_msec, bluetooth_tx_time_msec, bluetooth_power_mah
func ParseGlobalWifi ¶
func ParseGlobalWifi(record []string, system *bspb.BatteryStats_System) (string, []error)
ParseGlobalWifi parses "gwfl" (GLOBAL_WIFI_DATA") into system. format: 9,0,l,gwfl,9,10,11,12,13,14 wifi_on_time_msec, wifi_running_time_msec, wifi_idle_time_msec, wifi_rx_time_msec, wifi_tx_time_msec, wifi_power_mah
func ParseSlice ¶
func ParseSlice(pc checkinutil.Counter, name string, value []string, outputs ...interface{}) ([]string, error)
ParseSlice wraps sliceparse.Consume(value, outputs...), increasing pc if it returns an error.
func ParseSystemMisc ¶
func ParseSystemMisc(pc checkinutil.Counter, reportVersion int32, record []string, system *bspb.BatteryStats_System) (string, []error)
ParseSystemMisc parses "m"(MISC_DATA) in System. format: 9,0,l,m,12469,0,20657343842,0,0,0,11258,0,0,5000,2,3000,1 (reportVersion >= 14) 9,0,l,m,12469,0,228195853,228195672,0,0,0,8889296,3246978,0,20657343842,0,0,0,11258,0,0 (8 <= reportVersion < 14) 8,0,l,m,47452,0,19133321,19133231,0,0,0,1863222,1605056,0,918161,0 (reportVersion < 8)
screen on time, phone on time, [wifi on time, wifi running time, bluetooth on time, mobile rx total bytes, mobile tx total bytes, wifi rx total bytes, wifi tx total bytes, legacy input event count(always 0)] mobile radio active time, mobile radio active adjusted time low power mode enabled time, [# connectivity changes], [device idle mode enabled time, device idle mode enabled count, device idling time, device idling count]
func SortByCount ¶
func SortByCount(items []*WakelockInfo)
SortByCount ranks a slice of wakelocks by count.
func SortByTime ¶
func SortByTime(items []*WakelockInfo)
SortByTime ranks a slice of wakelocks by duration.