Documentation ¶
Overview ¶
Package perfutil provides utilities of storing performance data for UI tests.
Index ¶
- Constants
- Variables
- func CreateExpectations(ctx context.Context, histnames ...string) map[string]float64
- func StoreLatency(ctx context.Context, pv *Values, hists []*metrics.Histogram) error
- func StoreSmoothness(ctx context.Context, pv *Values, hists []*metrics.Histogram) error
- type Runner
- type ScenarioFunc
- type StoreFunc
- type Values
Constants ¶
const DefaultRuns = 10
DefaultRuns provides the default number of iteration for a perftest conducts.
Variables ¶
var UnstableModels = []string{
"esche",
"willow",
"lava",
"vilboz360",
"woomax",
}
UnstableModels is the list of the models which appear to be not stable on the UI performance tests.
Functions ¶
func CreateExpectations ¶
CreateExpectations creates the map of expected values for the given histogram names. It estimates the type of histogram (either of smoothness or latency) from the name.
func StoreLatency ¶
StoreLatency is a utility function to store input-latency metrics.
Types ¶
type Runner ¶
Runner is an entity to manage multiple runs of the test scenario.
func (*Runner) RunMultiple ¶
func (r *Runner) RunMultiple(ctx context.Context, s *testing.State, name string, scenario ScenarioFunc, store StoreFunc) bool
RunMultiple runs scenario multiple times and store the data through store function. It invokes scenario+store 10 times, and then invokes scenario only with tracing enabled. If one of the runs fails, it quits immediately and reports an error. The name parameter is used for the prefix of subtest names for calling scenario/store function and the prefix for the trace data file. The name can be empty, in which case the runner uses default prefix values. Returns false when it has an error.
type ScenarioFunc ¶
ScenarioFunc is the function to conduct the test operation and returns the metric value.
func RunAndWaitAll ¶
func RunAndWaitAll(tconn *chrome.TestConn, f func(ctx context.Context) error, names ...string) ScenarioFunc
RunAndWaitAll is a utility function to create ScenarioFunc which conducts f with metrics.RunAndWaitAll.
func RunAndWaitAny ¶
func RunAndWaitAny(tconn *chrome.TestConn, f func(ctx context.Context) error, names ...string) ScenarioFunc
RunAndWaitAny is a utility function to create ScenarioFunc which conducts f with metrics.RunAndWaitAny.
type StoreFunc ¶
StoreFunc is a function to be used for RunMultiple.
func StoreAllWithHeuristics ¶
StoreAllWithHeuristics is a utility function to store all metrics. It determines the direction of perf (bigger is better or smaller is better) and unit through heuristics from the name of metrics.
type Values ¶
type Values struct {
// contains filtered or unexported fields
}
Values keeps the reporting values for multiple runs.
func RunMultiple ¶
func RunMultiple(ctx context.Context, s *testing.State, br *browser.Browser, scenario ScenarioFunc, store StoreFunc) *Values
RunMultiple is a utility to create a new runner, conduct runs multiple times, and returns the recorded values.
func (*Values) Save ¶
Save is a shortcut of Values().Save(outdir). Helpful when the test does not have to combine with other data points.