Documentation
¶
Overview ¶
Package perf contains helper functions to collect performance informations.
Index ¶
- func NewMemoryDataSource(name, diffName, percentName string) *memoryDataSource
- func NewThermalDataSource() *thermalDataSource
- type BatteryInfoTracker
- type ByTimeStamp
- type CPUUsageSource
- type DisplayFrameData
- type DisplayInfo
- type DisplaySmoothnessTracker
- func (t *DisplaySmoothnessTracker) Close(ctx context.Context, tconn *chrome.TestConn) error
- func (t *DisplaySmoothnessTracker) Start(ctx context.Context, tconn *chrome.TestConn, displayID string) error
- func (t *DisplaySmoothnessTracker) Stop(ctx context.Context, tconn *chrome.TestConn, displayID string) (*DisplayFrameData, error)
- type FrameDataTracker
- func (t *FrameDataTracker) Close(ctx context.Context, tconn *chrome.TestConn) error
- func (t *FrameDataTracker) Record(pv *perf.Values)
- func (t *FrameDataTracker) Start(ctx context.Context, tconn *chrome.TestConn) error
- func (t *FrameDataTracker) Stop(ctx context.Context, tconn *chrome.TestConn) error
- type GPUDataSource
- func (ds *GPUDataSource) Close()
- func (ds *GPUDataSource) Setup(ctx context.Context, prefix string) error
- func (ds *GPUDataSource) Snapshot(ctx context.Context, values *perf.Values) error
- func (ds *GPUDataSource) Start(ctx context.Context) error
- func (ds *GPUDataSource) Stop(_ context.Context, values *perf.Values) error
- type LoginEventRecorder
- type LoginEventRecorderData
- type MemoryInfoTracker
- type SurfaceFlingerMetrics
- type ZramInfoTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMemoryDataSource ¶
func NewMemoryDataSource(name, diffName, percentName string) *memoryDataSource
NewMemoryDataSource creates a new instance of memoryDataSource with the given name.
func NewThermalDataSource ¶
func NewThermalDataSource() *thermalDataSource
NewThermalDataSource creates a new instance of thermalDataSource.
Types ¶
type BatteryInfoTracker ¶
type BatteryInfoTracker struct {
// contains filtered or unexported fields
}
BatteryInfoTracker is a helper to collect battery info.
func NewBatteryInfoTracker ¶
func NewBatteryInfoTracker(ctx context.Context, metricPrefix string) (*BatteryInfoTracker, error)
NewBatteryInfoTracker creates a new instance of BatteryInfoTracker. If battery is not used on the device, available flag is set to false and makes track a no-op.
func (*BatteryInfoTracker) Record ¶
func (t *BatteryInfoTracker) Record(pv *perf.Values)
Record stores the collected data into pv for further processing.
type ByTimeStamp ¶
type ByTimeStamp []LoginEventRecorderData
ByTimeStamp sort.Interface interface implementation to sort events by timestamp.
func (ByTimeStamp) Len ¶
func (e ByTimeStamp) Len() int
func (ByTimeStamp) Less ¶
func (e ByTimeStamp) Less(i, j int) bool
func (ByTimeStamp) Swap ¶
func (e ByTimeStamp) Swap(i, j int)
type CPUUsageSource ¶
type CPUUsageSource struct {
// contains filtered or unexported fields
}
CPUUsageSource is an implementation of perf.TimelineDataSource which reports the CPU usage.
func NewCPUUsageSource ¶
func NewCPUUsageSource(name string) *CPUUsageSource
NewCPUUsageSource creates a new instance of CPUUsageSource for the given metric name.
func (*CPUUsageSource) Setup ¶
func (s *CPUUsageSource) Setup(ctx context.Context, prefix string) error
Setup implements perf.TimelineDatasource.Setup.
type DisplayFrameData ¶
type DisplayFrameData struct { FramesExpected int `json:"framesExpected"` FramesProduced int `json:"framesProduced"` JankCount int `json:"jankCount"` Throughput []int `json:"throughput"` }
DisplayFrameData holds the collected display frame data.
type DisplayInfo ¶
type DisplayInfo struct {
// contains filtered or unexported fields
}
DisplayInfo stores display configurations.
func NewDisplayInfo ¶
NewDisplayInfo creates a DisplayInfo based on the current display mode. It assumes there is only one display connected.
func (DisplayInfo) Record ¶
func (d DisplayInfo) Record(values *perf.Values)
Record stores display information as performance metric values.
type DisplaySmoothnessTracker ¶
type DisplaySmoothnessTracker struct {
// contains filtered or unexported fields
}
DisplaySmoothnessTracker helps to start/stop display smoothness tracking.
func NewDisplaySmoothnessTracker ¶
func NewDisplaySmoothnessTracker() *DisplaySmoothnessTracker
NewDisplaySmoothnessTracker creates a DisplaySmoothnessTracker.
func (*DisplaySmoothnessTracker) Start ¶
func (t *DisplaySmoothnessTracker) Start(ctx context.Context, tconn *chrome.TestConn, displayID string) error
Start starts tracking for the given display id. Primary display is used if the given display id is empty.
func (*DisplaySmoothnessTracker) Stop ¶
func (t *DisplaySmoothnessTracker) Stop(ctx context.Context, tconn *chrome.TestConn, displayID string) (*DisplayFrameData, error)
Stop stops tracking for the given display id and report the smoothness since the relevant Start() call. Primary display is used if the given display id is empty.
type FrameDataTracker ¶
type FrameDataTracker struct {
// contains filtered or unexported fields
}
FrameDataTracker is helper to get animation frame data from Chrome.
func NewFrameDataTracker ¶
func NewFrameDataTracker(metricPrefix string) (*FrameDataTracker, error)
NewFrameDataTracker creates a new instance for FrameDataTracker.
func (*FrameDataTracker) Close ¶
Close ensures that the browser state (display smoothness tracking) is cleared.
func (*FrameDataTracker) Record ¶
func (t *FrameDataTracker) Record(pv *perf.Values)
Record stores the collected data into pv for further processing.
type GPUDataSource ¶
type GPUDataSource struct {
// contains filtered or unexported fields
}
GPUDataSource is helper to get gpu data from Chrome.
func NewGPUDataSource ¶
func NewGPUDataSource(tconn *chrome.TestConn) *GPUDataSource
NewGPUDataSource creates an instance of GPUDataSource.
func (*GPUDataSource) Close ¶
func (ds *GPUDataSource) Close()
Close stops the background goroutine in this data source.
func (*GPUDataSource) Setup ¶
func (ds *GPUDataSource) Setup(ctx context.Context, prefix string) error
Setup implements perf.TimelineDatasource.Setup.
type LoginEventRecorder ¶
type LoginEventRecorder struct {
// contains filtered or unexported fields
}
LoginEventRecorder is helper to get login events data from Chrome. loginEventData is kept sorted by timestamp.
func NewLoginEventRecorder ¶
func NewLoginEventRecorder(metricPrefix string) *LoginEventRecorder
NewLoginEventRecorder creates a new instance for LoginEventRecorder.
func (*LoginEventRecorder) FetchLoginEvents ¶
FetchLoginEvents fetches and sorts all LoginEventRecorder data.
type LoginEventRecorderData ¶
type LoginEventRecorderData struct { Name string `json:"name"` MicrosecnodsSinceUnixEpoch int64 `json:"microsecnods_since_unix_epoch"` }
LoginEventRecorderData holds the collected login events.
type MemoryInfoTracker ¶
type MemoryInfoTracker struct {
// contains filtered or unexported fields
}
MemoryInfoTracker is a helper to collect zram info.
func NewMemoryTracker ¶
func NewMemoryTracker(arcp *arc.ARC) *MemoryInfoTracker
NewMemoryTracker creates a new instance of MemoryInfoTracker. This will take a snapshot of memory stats, which is used as a base to subtract (delta) from future measurements.
func (*MemoryInfoTracker) Record ¶
func (t *MemoryInfoTracker) Record(pv *perf.Values)
Record stores the collected data into pv for further processing.
type SurfaceFlingerMetrics ¶
type SurfaceFlingerMetrics struct {
// contains filtered or unexported fields
}
SurfaceFlingerMetrics contains information needed to call SurfaceFlinger and data returned by SurfaceFlinger.
func NewSurfaceFlingerMetrics ¶
func NewSurfaceFlingerMetrics(surfaceName string, a *arc.ARC) *SurfaceFlingerMetrics
NewSurfaceFlingerMetrics returns a new instance of SurfaceFlinger.
type ZramInfoTracker ¶
type ZramInfoTracker struct {
// contains filtered or unexported fields
}
ZramInfoTracker is a helper to collect zram info.
func NewZramInfoTracker ¶
func NewZramInfoTracker(metricPrefix string) (*ZramInfoTracker, error)
NewZramInfoTracker creates a new instance of ZramInfoTracker. If zram is not used on the device, hasZram flag is set to false and makes track a no-op.
func (*ZramInfoTracker) Record ¶
func (t *ZramInfoTracker) Record(pv *perf.Values)
Record stores the collected data into pv for further processing.