checkinparse

package
v0.0.0-...-fd24290 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package checkinparse contains functions to parse checkin report into batterystats proto.

Index

Constants

This section is empty.

Variables

View Source
var (

	// KnownUIDs lists all constant UIDs defined in system/core/include/private/android_filesystem_config.h.
	// GIDs are excluded. These should never be renumbered.
	KnownUIDs = map[int32]string{
		0:    "ROOT",
		1000: "ANDROID_SYSTEM",
		1001: "RADIO",
		1002: "BLUETOOTH",
		1003: "GRAPHICS",
		1004: "INPUT",
		1005: "AUDIO",
		1006: "CAMERA",
		1007: "LOG",
		1008: "COMPASS",
		1009: "MOUNT",
		1010: "WIFI",
		1011: "ADB",
		1012: "INSTALL",
		1013: "MEDIA",
		1014: "DHCP",
		1015: "SDCARD_RW",
		1016: "VPN",
		1017: "KEYSTORE",
		1018: "USB",
		1019: "DRM",
		1020: "MDNSR",
		1021: "GPS",

		1023: "MEDIA_RW",
		1024: "MTP",

		1026: "DRMRPC",
		1027: "NFC",
		1028: "SDCARD_R",
		1029: "CLAT",
		1030: "LOOP_RADIO",
		1031: "MEDIA_DRM",
		1032: "PACKAGE_INFO",
		1033: "SDCARD_PICS",
		1034: "SDCARD_AV",
		1035: "SDCARD_ALL",
		1036: "LOGD",
		1037: "SHARED_RELRO",
		1038: "DBUS",
		1039: "TLSDATE",
		1040: "MEDIA_EX",
		1041: "AUDIOSERVER",
		1042: "METRICS_COLL",
		1043: "METRICSD",
		1044: "WEBSERV",
		1045: "DEBUGGERD",
		1046: "MEDIA_CODEC",
		1047: "CAMERASERVER",
		1048: "FIREWALL",
		1049: "TRUNKS",

		2000: "SHELL",
		2001: "CACHE",
		2002: "DIAG",

		3001: "NET_BT_ADMIN",
		3002: "NET_BT",
		3003: "INET",
		3004: "NET_RAW",
		3005: "NET_ADMIN",
		3006: "NET_BW_STATS",
		3007: "NET_BW_ACCT",
		3008: "NET_BT_STACK",
		3009: "READPROC",
		3010: "WAKELOCK",

		9997: "EVERYBODY",
		9998: "MISC",
		9999: "NOBODY",
	}
)

Functions

func CreateBatteryReport

func CreateBatteryReport(cp *sessionpb.Checkin) *checkinutil.BatteryReport

CreateBatteryReport creates a checkinutil.BatteryReport from the given sessionpb.Checkin.

func GroupName

func GroupName(sharedUIDLabel string) string

GroupName returns a predefined UID group name for the given sharedUserID label. If there is no predefined name, then an empty string is returned.

func PackageUIDGroupName

func PackageUIDGroupName(pkg string) string

PackageUIDGroupName returns the predefined group name for the given package name. It will return an empty string if there is no predefined group name.

func ParseBatteryStats

func ParseBatteryStats(pc checkinutil.Counter, cr *checkinutil.BatteryReport, 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 SortByAbsTime

func SortByAbsTime(items []*WakelockInfo)

SortByAbsTime ranks a slice of wakelocks by the absolute value of duration in desc order.

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.

func SystemBattery

func SystemBattery(pc checkinutil.Counter, record []string, system *bspb.BatteryStats_System) (string, []error)

SystemBattery parses "bt" (BATTERY_DATA) in System.

format:

7,0,l,bt,N/A,4946,4946,25430,25430 (reportVersion < 8)
9,0,l,bt,0,19447364,2268899,19466586,2288120,1411399763148,19399912,2221446 (reportVersion >= 8)

Types

type WakelockInfo

type WakelockInfo struct {
	Name     string
	UID      int32
	Duration time.Duration
	Count    float32
}

WakelockInfo is a data structure used to sort wakelocks by time or count.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL