bigquery

package
v0.0.0-202406181927 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package bigquery defines a BigQuery schema for benchmarks.

This package contains a schema for BigQuery and methods for publishing benchmark data into tables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitBigQuery

func InitBigQuery(ctx context.Context, projectID, datasetID, tableID string, opts []option.ClientOption) error

InitBigQuery initializes a BigQuery dataset/table in the project. If the dataset/table already exists, it is not duplicated.

func SendBenchmarks

func SendBenchmarks(ctx context.Context, suite *Suite, projectID, datasetID, tableID string, opts []option.ClientOption) error

SendBenchmarks sends the slice of benchmarks to the BigQuery dataset/table.

Types

type Benchmark

type Benchmark struct {
	Name      string       `bq:"name"`
	Condition []*Condition `bq:"cond"`
	Metric    []*Metric    `bq:"metric"`
}

Benchmark represents an individual benchmark in a suite.

func NewBenchmark

func NewBenchmark(name string, iters int) *Benchmark

NewBenchmark initializes a new benchmark.

func NewBenchmarkWithMetric

func NewBenchmarkWithMetric(name, metric, unit string, value float64) *Benchmark

NewBenchmarkWithMetric creates a new sending to BigQuery, initialized with a single iteration and single metric.

func (*Benchmark) AddCondition

func (bm *Benchmark) AddCondition(name, value string)

AddCondition adds a condition to an existing Benchmark.

func (*Benchmark) AddMetric

func (bm *Benchmark) AddMetric(metricName, unit string, sample float64)

AddMetric adds a metric to an existing Benchmark.

func (*Benchmark) String

func (bm *Benchmark) String() string

String implements the String method for Benchmark

type Condition

type Condition struct {
	Name  string `bq:"name"`
	Value string `bq:"value"`
}

Condition represents qualifiers for the benchmark or suite. For example: Get_Pid/1/real_time would have Benchmark Name "Get_Pid" with "1" and "real_time" parameters as conditions. Suite conditions include information such as the CL number and platform name.

func NewCondition

func NewCondition(name, value string) *Condition

NewCondition returns a new Condition with the given name and value.

func (*Condition) String

func (c *Condition) String() string

type Metric

type Metric struct {
	Name   string  `bq:"name"`
	Unit   string  `bq:"unit"`
	Sample float64 `bq:"sample"`
}

Metric holds the actual metric data and unit information for this benchmark.

func (*Metric) String

func (m *Metric) String() string

type Suite

type Suite struct {
	Name       string       `bq:"name"`
	Conditions []*Condition `bq:"conditions"`
	Benchmarks []*Benchmark `bq:"benchmarks"`
	Official   bool         `bq:"official"`
	Timestamp  time.Time    `bq:"timestamp"`
}

Suite is the top level structure for a benchmark run. BigQuery will infer the schema from this.

func NewSuite

func NewSuite(name string, official bool) *Suite

NewSuite initializes a new Suite.

func (*Suite) Benchstat

func (s *Suite) Benchstat(includeConditions []string) string

Benchstat returns a benchstat-formatted output string. See https://pkg.go.dev/golang.org/x/perf/cmd/benchstat `includeConditions` contains names of `Condition`s that should be included as part of the benchmark name.

func (*Suite) String

func (s *Suite) String() string

Jump to

Keyboard shortcuts

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