aggregated

package
v0.0.0-...-d2356ba Latest Latest
Warning

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

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

Documentation

Overview

Package aggregated constructs a checkin struct from a given batterystats proto. The checkin struct contains data categorized by each metric.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PkgAndSub

func PkgAndSub(t string) (string, string)

PkgAndSub splits up a string into the separate pkg name and metric sub name. If the two values are present in the string, then they must be delineated by a colon.

Types

type ANRCrashData

type ANRCrashData struct {
	Name                 string
	UID                  int32
	ANRCount, CrashCount int32
}

ANRCrashData contains ANR and crash data for a single app.

type ActivityData

type ActivityData struct {
	Name         string
	Title        string
	UID          int32
	Count        float32
	CountPerHour float32
	CountLevel   string // Low, Medium, High
	// MaxDuration is the single longest duration of this ActivityData. This could sometimes be
	// greater than Duration (eg. in the case of a wakelock whose time was split with another
	// wakelock -- 2 wakelocks held for an hour each -> Duration would be 30 minutes for each,
	// but MaxDuration would be one hour).
	MaxDuration time.Duration
	Duration    time.Duration
	// TotalDuration is used to track the total duration of metrics. This may be different from
	// Duration for metrics such as wakelocks, which will have Duration set to the apportioned
	// duration.
	TotalDuration time.Duration
	// SecondsPerHr based on TotalDuration, if available, otherwise, based on Duration.
	SecondsPerHr  float32
	DurationLevel string // Low, Medium, High
	Level         string // The maximum of CountLevel and DurationLevel.
}

ActivityData contains count and duration stats about activity on the device. The UID field will be pouplated (non-zero) if the activity is connected to a specific UID.

type AppData

type AppData struct {
	Name             string
	UID              int32
	Alarms           RateData
	CPU              CPUData
	GPSUse           ActivityData
	ScheduledJobs    ActivityData
	Network          NetworkTrafficData
	PartialWakelocks ActivityData
	Syncs            ActivityData
	WifiScan         ActivityData
}

AppData contains aggregated values for some app metrics.

type ByCPUUsage

type ByCPUUsage []CPUData

ByCPUUsage sorts CPUData by the power usage in descending order. In case of similar power usage, sort according to cpu time.

func (ByCPUUsage) Len

func (a ByCPUUsage) Len() int

func (ByCPUUsage) Less

func (a ByCPUUsage) Less(i, j int) bool

func (ByCPUUsage) Swap

func (a ByCPUUsage) Swap(i, j int)

type ByMobileBytes

type ByMobileBytes []NetworkTrafficData

ByMobileBytes sorts NetworkTrafficData by the amount of bytes transferred over mobile.

func (ByMobileBytes) Len

func (n ByMobileBytes) Len() int

func (ByMobileBytes) Less

func (n ByMobileBytes) Less(i, j int) bool

Less sorts in decreasing order.

func (ByMobileBytes) Swap

func (n ByMobileBytes) Swap(i, j int)

type ByWifiBytes

type ByWifiBytes []NetworkTrafficData

ByWifiBytes sorts NetworkTrafficData by the amount of bytes transferred over mobile.

func (ByWifiBytes) Len

func (n ByWifiBytes) Len() int

func (ByWifiBytes) Less

func (n ByWifiBytes) Less(i, j int) bool

Less sorts in decreasing order.

func (ByWifiBytes) Swap

func (n ByWifiBytes) Swap(i, j int)

type CPUData

type CPUData struct {
	Name       string // App name.
	UID        int32
	UserTime   time.Duration
	SystemTime time.Duration
	PowerPct   float32 // Percentage of device power used.

	UserTimeLevel   string // Low, Medium, High
	SystemTimeLevel string // Low, Medium, High
	Level           string // The maximum of UserTimeLevel and SystemTimeLevel.
}

CPUData contains data about app CPU usage.

func (CPUData) CPUSecs

func (a CPUData) CPUSecs() float64

CPUSecs returns the total CPU duration in seconds.

type Checkin

type Checkin struct {
	Device           string
	Build            string
	BuildFingerprint string
	ReportVersion    int32

	ScreenOffDischargePoints float32
	ScreenOnDischargePoints  float32
	ActualDischarge          float32 // mAh
	EstimatedDischarge       float32 // mAh
	WifiDischargePoints      float32
	BluetoothDischargePoints float32
	ModemDischargePoints     float32

	Realtime          time.Duration
	ScreenOffRealtime time.Duration

	Uptime                          MDuration
	ScreenOffUptime                 MDuration
	ScreenOffUptimePercentage       float32
	ScreenOnTime                    MDuration
	ScreenOnTimePercentage          float32
	PartialWakelockTime             MDuration
	PartialWakelockTimePercentage   float32
	KernelOverheadTime              MDuration
	KernelOverheadTimePercentage    float32
	SignalScanningTime              MDuration
	SignalScanningTimePercentage    float32
	MobileActiveTime                MDuration
	MobileActiveTimePercentage      float32
	WifiOnTime                      MDuration
	WifiOnTimePercentage            float32
	WifiIdleTime                    MDuration
	WifiTransferTime                MDuration // tx + rx
	WifiTransferTimePercentage      float32
	BluetoothIdleTime               MDuration
	BluetoothTransferTime           MDuration // tx + rx
	BluetoothTransferTimePercentage float32
	ModemIdleTime                   MDuration
	ModemTransferTime               MDuration // tx + rx
	ModemTransferTimePercentage     float32

	PhoneCallTime                       MDuration
	PhoneCallTimePercentage             float32
	DeviceIdlingTime                    MDuration
	DeviceIdlingTimePercentage          float32
	FullWakelockTime                    MDuration
	FullWakelockTimePercentage          float32
	InteractiveTime                     MDuration
	InteractiveTimePercentage           float32
	DeviceIdleModeEnabledTime           MDuration
	DeviceIdleModeEnabledTimePercentage float32

	ScreenOffDischargeRatePerHr MFloat32
	ScreenOnDischargeRatePerHr  MFloat32
	MobileKiloBytesPerHr        MFloat32
	WifiKiloBytesPerHr          MFloat32
	WifiDischargeRatePerHr      MFloat32
	BluetoothDischargeRatePerHr MFloat32
	ModemDischargeRatePerHr     MFloat32

	// Aggregated across all apps/entries.
	AggCameraUse            ActivityData
	AggFlashlightUse        ActivityData
	AggGPSUse               ActivityData
	AggKernelWakelocks      ActivityData
	AggScheduledJobs        ActivityData
	AggSyncTasks            ActivityData
	AggWakeupReasons        ActivityData
	AggWifiScanActivity     ActivityData
	AggWifiFullLockActivity ActivityData
	AggAppWakeups           RateData
	AggCPUUsage             CPUData

	// Each element corresponds to a single entry/app.
	UserspaceWakelocks   []ActivityData
	KernelWakelocks      []ActivityData
	ScheduledJobs        []ActivityData
	SyncTasks            []ActivityData
	WakeupReasons        []ActivityData
	GPSUse               []ActivityData
	TopMobileActiveApps  []ActivityData
	WifiScanActivity     []ActivityData
	WifiFullLockActivity []ActivityData
	CameraUse            []ActivityData
	FlashlightUse        []ActivityData

	TopMobileTrafficApps []NetworkTrafficData
	TopWifiTrafficApps   []NetworkTrafficData

	DevicePowerEstimates []PowerUseData

	AppWakeups            []RateData
	AppWakeupsByAlarmName []RateData

	ANRAndCrash []ANRCrashData

	CPUUsage []CPUData

	AppStates []stateData

	AggregatedApps []AppData

	TotalAppGPSUseTimePerHour         float32
	TotalAppCPUPowerPct               float32
	BluetoothOnTime                   MDuration
	BluetoothOnTimePercentage         float32
	LowPowerModeEnabledTime           MDuration
	LowPowerModeEnabledTimePercentage float32
	TotalAppANRCount                  int32
	TotalAppANRRate                   float32
	TotalAppCrashCount                int32
	TotalAppCrashRate                 float32
	TotalAppScheduledJobsPerHr        float32
	TotalAppSyncsPerHr                float32
	TotalAppWakeupsPerHr              float32
	TotalAppFlashlightUsePerHr        float32
	TotalAppCameraUsePerHr            float32
	ConnectivityChanges               float32

	ScreenBrightness   map[string]float32
	SignalStrength     map[string]float32
	WifiSignalStrength map[string]float32
	BluetoothState     map[string]float32
	DataConnection     map[string]float32
}

Checkin contains the aggregated batterystats data for a bugreport.

func ParseCheckinData

func ParseCheckinData(c *bspb.BatteryStats) Checkin

ParseCheckinData creates a Checkin struct from the given aggregated battery stats.

type MDuration

type MDuration struct {
	V time.Duration
	L string // Low, Medium, High
}

MDuration holds the duration and the classification level for the value.

type MFloat32

type MFloat32 struct {
	V float32
	L string // Low, Medium, High
}

MFloat32 holds the float value and the classification level for the value.

type NetworkTrafficData

type NetworkTrafficData struct {
	Name                   string
	UID                    int32
	WifiMegaBytes          float32
	MobileMegaBytes        float32
	WifiMegaBytesPerHour   float32
	MobileMegaBytesPerHour float32
	WifiLevel              string // Low, medium, high
	MobileLevel            string // Low, medium, high
	Level                  string // The maximum of WifiLevel and MobileLevel.
}

NetworkTrafficData contains the total amount of bytes transferred over mobile and wifi.

type PowerUseData

type PowerUseData struct {
	Name    string
	UID     int32
	Percent float32 // Percentage of total consumption
}

PowerUseData contains percentage battery consumption for apps and system elements.

type RateData

type RateData struct {
	Name       string
	UID        int32
	Count      float32
	CountPerHr float32
	CountLevel string // Low, Medium, High
}

RateData contains total count and rate for various app metrics.

Jump to

Keyboard shortcuts

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