Documentation
¶
Index ¶
- type Category
- type Config
- func (c *Config) EncodeYAML(w io.Writer) error
- func (c Config) FindContext(name string) (id string, ok bool)
- func (c Config) FindContextFromFile(file string) (id string, ok bool)
- func (c Config) FindFunction(name string) (id string, ok bool)
- func (c Config) FindVersion(name string) (id string, ok bool)
- func (c Config) FindVersionFromFile(file string) (id string, ok bool)
- func (c Config) GetContext(id string) (Context, bool)
- func (c Config) GetFunction(id string) (Function, bool)
- func (c Config) GetMetric(id MetricName) (Metric, bool)
- func (c Config) GetVersion(id string) (Version, bool)
- type Context
- type File
- type Function
- type GenerateInput
- type Includes
- type Layout
- type LegendPosition
- type Metric
- type MetricName
- type Object
- type Orientation
- type Output
- type Rendering
- type Scale
- type Screenshot
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string
IsJSON bool `mapstructure:"-"`
IsStrict bool `mapstructure:"-"`
Environment string
Render Rendering
Outputs Output `mapstructure:"-"`
Metrics []Metric
Functions []Function
Contexts []Context
Versions []Version
Categories []Category
Files []File // Files allows for enrichments based on the input file name
// contains filtered or unexported fields
}
Config holds the configuration for benchviz.
func Generate ¶
func Generate(input GenerateInput) *Config
Generate builds a Config from parsed benchmark data.
It creates one function entry per unique benchmark name, includes all detected metrics, and bundles everything into a single "all" category.
func LoadDefaults ¶
LoadDefaults loads the default configuration from the embedded default_config.yaml.
func (*Config) EncodeYAML ¶
EncodeYAML serializes a Config to YAML into the provided writer.
Runtime-only fields (IsJSON, IsStrict, Outputs) are excluded from the output.
func (Config) FindContext ¶
FindContext returns the ID of the first context whose regexp matches the given benchmark name.
func (Config) FindContextFromFile ¶
FindContextFromFile returns the ID of the first context matched by a file-based rule.
func (Config) FindFunction ¶
FindFunction returns the ID of the first function whose regexp matches the given benchmark name.
func (Config) FindVersion ¶
FindVersion returns the ID of the first version whose regexp matches the given benchmark name.
func (Config) FindVersionFromFile ¶
FindVersionFromFile returns the ID of the first version matched by a file-based rule.
func (Config) GetContext ¶
GetContext retrieves a context definition by its ID.
func (Config) GetFunction ¶
GetFunction retrieves a function definition by its ID.
func (Config) GetMetric ¶
func (c Config) GetMetric(id MetricName) (Metric, bool)
GetMetric retrieves a metric definition by its MetricName.
type Context ¶
type Context struct {
Object `mapstructure:",deep,squash"`
}
Context identifies a benchmark context (e.g. input size, data type) by regexp matching.
type File ¶
type File struct {
ID string
MatchFile string
Contexts []Context
Versions []Version
// contains filtered or unexported fields
}
File defines a file-matching rule that enriches benchmarks with version or context based on filename.
type Function ¶
type Function struct {
Object `mapstructure:",deep,squash"`
}
Function identifies a benchmark function by regexp matching on its name.
type GenerateInput ¶
type GenerateInput struct {
Functions []string
Metrics []MetricName
}
GenerateInput holds the data needed by Generate to build a configuration from parsed benchmark results.
This avoids importing the parser package (which imports config).
type Includes ¶
type Includes struct {
Functions []string
Versions []string
Contexts []string
Metrics []MetricName
}
Includes lists the IDs of functions, versions, contexts and metrics included in a Category.
type LegendPosition ¶
type LegendPosition string
LegendPosition controls where the chart legend is displayed.
const ( LegendPositionNone LegendPosition = "none" LegendPositionBottom LegendPosition = "bottom" LegendPositionTop LegendPosition = "top" LegendPositionLeft LegendPosition = "left" LegendPositionRight LegendPosition = "right" )
Supported legend positions.
type Metric ¶
type Metric struct {
ID MetricName
Title string
Axis string
}
Metric defines a benchmark metric with its display title and axis label.
type MetricName ¶
type MetricName string
MetricName identifies a benchmark metric (e.g. "nsPerOp", "allocsPerOp").
const ( MetricNsPerOp MetricName = "nsPerOp" MetricAllocsPerOp MetricName = "allocsPerOp" MetricBytesPerOp MetricName = "bytesPerOp" MetricMBPerS MetricName = "MBytesPerS" )
Standard benchmark metric names.
func AllMetricNames ¶
func AllMetricNames() []MetricName
AllMetricNames returns all known benchmark metric names.
func (MetricName) IsValid ¶
func (m MetricName) IsValid() bool
IsValid reports whether the metric name is one of the known benchmark metrics.
func (MetricName) String ¶
func (m MetricName) String() string
String returns the metric name as a plain string.
type Object ¶
type Object struct {
ID string
Title string
Match string
NotMatch string
// contains filtered or unexported fields
}
Object is the base type for regexp-matched configuration entries (functions, contexts, versions).
func (Object) MatchString ¶
MatchString reports whether name matches the object's positive regexp and not its negative regexp.
type Orientation ¶
type Orientation string
Orientation controls the chart bar direction.
const ( OrientationVertical Orientation = "vertical" OrientationHorizontal Orientation = "horizontal" )
Supported chart orientations.
type Rendering ¶
type Rendering struct {
Title string
Theme string
Layout Layout
Chart string
Legend LegendPosition
Scale Scale
DualScale bool
Orientation Orientation
Screenshot Screenshot
}
Rendering holds chart rendering settings (theme, layout, legend, scale).
type Screenshot ¶
Screenshot configures the headless Chrome screenshot used for PNG rendering.
func (Screenshot) SleepDuration ¶
func (s Screenshot) SleepDuration() time.Duration
SleepDuration parses the Sleep field as a time.Duration.