presenter

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: 14 Imported by: 0

Documentation

Overview

Package presenter contains the logic to create data structures for HTML presentation of Battery Historian analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityDataDiff

type ActivityDataDiff struct {
	Name             string
	Entries          [2]aggregated.ActivityData // Array stores data for file1 and file2.
	CountPerHourDiff float32                    // Difference in CountPerHr for the two files.
	SecondsPerHrDiff float32                    // Difference in durPerHr for the two files.
}

ActivityDataDiff stores the combined activity data for the 2 files being compared.

type AppStat

type AppStat struct {
	DevicePowerPrediction float32
	CPUPowerPrediction    float32 // Device estimated power use due to CPU usage.
	RawStats              *bspb.BatteryStats_App
	Sensor                []bugreportutils.SensorInfo
	UserActivity          []userActivity
}

AppStat contains the parsed app data from a bugreport. This contains the raw App proto in github.com/google/battery-historian/pb/batterystats.proto but includes some custom fields that need to be processed before conversion to JS.

type CombinedCheckinSummary

type CombinedCheckinSummary struct {
	UserspaceWakelocksCombined   []ActivityDataDiff
	KernelWakelocksCombined      []ActivityDataDiff
	SyncTasksCombined            []ActivityDataDiff
	WakeupReasonsCombined        []ActivityDataDiff
	TopMobileActiveAppsCombined  []ActivityDataDiff
	TopMobileTrafficAppsCombined []NetworkTrafficDataDiff
	TopWifiTrafficAppsCombined   []NetworkTrafficDataDiff
	DevicePowerEstimatesCombined []PowerUseDataDiff
	WifiFullLockActivityCombined []ActivityDataDiff
	GPSUseCombined               []ActivityDataDiff
	CameraUseCombined            []ActivityDataDiff
	FlashlightUseCombined        []ActivityDataDiff
	AppWakeupsCombined           []RateDataDiff
	ANRAndCrashCombined          []anrCrashDataDiff
	CPUUsageCombined             []cpuDataDiff
}

CombinedCheckinSummary is the combined structure for the 2 files being compared

type DurationStats

type DurationStats struct {
	Name          string
	NumRate       float64
	DurationRate  float64
	Num           int32
	TotalDuration time.Duration
	MaxDuration   time.Duration
	NumLevel      string
	DurationLevel string
}

DurationStats contain stats on the occrurence frequency and activity duration of a metric present in history.

type HTMLData

type HTMLData struct {
	SDKVersion             int
	DeviceID               string
	DeviceModel            string
	Historian              template.HTML
	Count                  int
	UnplugSummaries        []UnplugSummary
	CheckinSummary         aggregated.Checkin
	Error                  string
	Warning                string
	Filename               string
	AppStats               []AppStat
	Overflow               bool
	HasBatteryStatsHistory bool
}

HTMLData is the main structure passed to the frontend HTML template containing all analysis items.

func Data

func Data(meta *bugreportutils.MetaInfo, fname string, summaries []parseutils.ActivitySummary,
	checkinOutput *bspb.BatteryStats, historianOutput string,
	warnings []string, errs []error, overflow, hasBatteryStatsHistory bool) HTMLData

Data returns a single structure (HTMLData) containing aggregated battery stats in html format.

type HistogramStats

type HistogramStats struct {
	//Screen Data
	ScreenOffDischargeRatePerHr aggregated.MFloat32
	ScreenOnDischargeRatePerHr  aggregated.MFloat32
	ScreenOffUptimePercentage   float32
	ScreenOnTimePercentage      float32
	// Data Transfer
	MobileKiloBytesPerHr            aggregated.MFloat32
	WifiKiloBytesPerHr              aggregated.MFloat32
	WifiDischargeRatePerHr          aggregated.MFloat32
	BluetoothDischargeRatePerHr     aggregated.MFloat32
	ModemDischargeRatePerHr         aggregated.MFloat32
	WifiOnTimePercentage            float32
	WifiTransferTimePercentage      float32
	BluetoothTransferTimePercentage float32
	ModemTransferTimePercentage     float32
	BluetoothOnTimePercentage       float32
	// Wakelock Data
	PartialWakelockTimePercentage float32
	KernelOverheadTimePercentage  float32
	FullWakelockTimePercentage    float32
	// Usage Data
	SignalScanningTimePercentage        float32
	MobileActiveTimePercentage          float32
	PhoneCallTimePercentage             float32
	DeviceIdlingTimePercentage          float32
	InteractiveTimePercentage           float32
	DeviceIdleModeEnabledTimePercentage float32
	LowPowerModeEnabledTimePercentage   float32
	// App Data
	TotalAppGPSUseTimePerHour  float32
	TotalAppANRCount           int32
	TotalAppCrashCount         int32
	TotalAppSyncsPerHr         float32
	TotalAppWakeupsPerHr       float32
	TotalAppCPUPowerPct        float32
	TotalAppFlashlightUsePerHr float32
	TotalAppCameraUsePerHr     float32
	ConnectivityChanges        float32
	// Pie charts data.
	ScreenBrightness   map[string]float32
	SignalStrength     map[string]float32
	WifiSignalStrength map[string]float32
	BluetoothState     map[string]float32
	DataConnection     map[string]float32
}

HistogramStats is the struct that contains all the checkin metrics which are passed to HTML in order to generate the histogram charts.

type MultiDurationStats

type MultiDurationStats struct {
	Metric string
	Stats  []DurationStats
}

MultiDurationStats contains named DurationStats.

type MultiFileHTMLData

type MultiFileHTMLData struct {
	SDKVersion          []int
	MinSDKVersion       int // This holds the minimum of the SDK Versions for both the files.
	DeviceID            []string
	DeviceModel         []string
	Historian           []template.HTML
	Count               []int
	UnplugSummaries     [][]UnplugSummary
	CheckinSummary      []aggregated.Checkin
	CombinedCheckinData CombinedCheckinSummary
	Filename            []string
	Error               string
	Warning             string
	Overflow            bool
	AppStats            []AppStat
}

MultiFileHTMLData is the main structure passed to the frontend HTML template containing all analysis items for both the files.

func MultiFileData

func MultiFileData(data []HTMLData) MultiFileHTMLData

MultiFileData returns a single structure (MultiFileHTMLData) containing aggregated battery stats for both the compare files in html format.

type NetworkTrafficDataDiff

type NetworkTrafficDataDiff struct {
	Name                       string
	Entries                    [2]aggregated.NetworkTrafficData // Array stores data for file1 and file2.
	WifiMegaBytesPerHourDiff   float32
	MobileMegaBytesPerHourDiff float32
}

NetworkTrafficDataDiff stores combined network traffic data for the 2 files being compared.

type PowerUseDataDiff

type PowerUseDataDiff struct {
	Name           string
	Entries        [2]aggregated.PowerUseData
	PercentageDiff float32
}

PowerUseDataDiff holds PowerUseData info for the 2 files being compared.

type RateDataDiff

type RateDataDiff struct {
	Name           string
	Entries        [2]aggregated.RateData // Array stores data for file1 and file2.
	CountPerHrDiff float32                // Difference in CountPerHr for the two files.
}

RateDataDiff contains the combined app metrics for file1 and file2.

type UnplugSummary

type UnplugSummary struct {
	Date             string
	Reason           string
	SummaryStart     string
	SummaryEnd       string
	Duration         string
	LevelDrop        int32
	LevelDropPerHour float64
	SystemStats      []DurationStats
	BreakdownStats   []MultiDurationStats
	PowerStates      map[string]parseutils.PowerState
}

UnplugSummary contains stats processed from battery history during discharge intervals.

Jump to

Keyboard shortcuts

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