perf

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package perf contains helper functions to collect performance informations.

Index

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.

func (*BatteryInfoTracker) Start

func (t *BatteryInfoTracker) Start(ctx context.Context) error

Start indicates that the battery tracking should start. It sets the batteryChargeStart value.

func (*BatteryInfoTracker) Stop

func (t *BatteryInfoTracker) Stop(ctx context.Context) error

Stop indicates that the battery tracking should stop. It sets the batteryChargeEnd value.

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.

func (*CPUUsageSource) Snapshot

func (s *CPUUsageSource) Snapshot(ctx context.Context, values *perf.Values) error

Snapshot implements perf.TimelineDatasource.Snapshot.

func (*CPUUsageSource) Start

func (s *CPUUsageSource) Start(ctx context.Context) error

Start implements perf.TimelineDatasource.Start.

func (*CPUUsageSource) Stop

func (s *CPUUsageSource) Stop(_ context.Context, values *perf.Values) error

Stop does nothing.

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

func NewDisplayInfo(ctx context.Context, tconn *chrome.TestConn) (*DisplayInfo, error)

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) Close

Close ensures all started tracking is stopped.

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

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

func (t *FrameDataTracker) Close(ctx context.Context, tconn *chrome.TestConn) error

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.

func (*FrameDataTracker) Start

func (t *FrameDataTracker) Start(ctx context.Context, tconn *chrome.TestConn) error

Start starts the animation data collection.

func (*FrameDataTracker) Stop

func (t *FrameDataTracker) Stop(ctx context.Context, tconn *chrome.TestConn) error

Stop stops the animation data collection and stores the collected data.

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.

func (*GPUDataSource) Snapshot

func (ds *GPUDataSource) Snapshot(ctx context.Context, values *perf.Values) error

Snapshot implements perf.TimelineDatasource.Snapshot.

func (*GPUDataSource) Start

func (ds *GPUDataSource) Start(ctx context.Context) error

Start implements perf.TimelineDatasource.Start.

func (*GPUDataSource) Stop

func (ds *GPUDataSource) Stop(_ context.Context, values *perf.Values) error

Stop does nothing.

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

func (t *LoginEventRecorder) FetchLoginEvents(ctx context.Context, tconn *chrome.TestConn) error

FetchLoginEvents fetches and sorts all LoginEventRecorder data.

func (*LoginEventRecorder) Prepare

func (t *LoginEventRecorder) Prepare(ctx context.Context, tconn *chrome.TestConn) error

Prepare notifies Chrome to store a copy of login events for later retrieval.

func (*LoginEventRecorder) Record

func (t *LoginEventRecorder) Record(ctx context.Context, pv *perf.Values)

Record stores the collected data into pv for further processing.

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.

func (*MemoryInfoTracker) Start

func (t *MemoryInfoTracker) Start(ctx context.Context) error

Start indicates that periodic memory tracking should start.

func (*MemoryInfoTracker) Stop

func (t *MemoryInfoTracker) Stop(ctx context.Context) error

Stop indicates that periodic memory tracking must stop. It will also log metrics collected during test.

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.

func (*ZramInfoTracker) Start

func (t *ZramInfoTracker) Start(ctx context.Context) error

Start indicates that the zram tracking should start. It resets the mem_used_max counter and captures the value after reset.

func (*ZramInfoTracker) Stop

func (t *ZramInfoTracker) Stop(ctx context.Context) error

Stop indicates that the zram tracking should stop. It reads the current mm_stat and store relevant info.

Jump to

Keyboard shortcuts

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