diagnostics

package
v0.0.0-...-f862e5e Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFlagsForDriver

func SetFlagsForDriver(f *flag.FlagSet) map[Type]*DriverConfig

Types

type Config

type Config struct {
	// Type is the diagnostic to collect data for.
	Type

	// Flags is additional opaque configuration for data collection.
	//
	// Currently only used if Type == Perf.
	Flags string
}

Config is an intent to collect data for some diagnostic with some room for additional configuration as to how that data is collected.

func ParseConfig

func ParseConfig(d string) (Config, error)

ParseConfig derives a Config from a string. The string must take the form

<type>[=<flags>]

where [=<flags>] is only accepted if <type> is perf.

func (Config) DriverArgs

func (d Config) DriverArgs(resultsDir string) []string

DriverArgs returns the arguments that should be passed to a Sweet benchmark binary to collect data for the Config.

func (Config) String

func (d Config) String() string

String returns the string representation of a Config, as it would appear in a Sweet common.Config.

type ConfigSet

type ConfigSet struct {
	// contains filtered or unexported fields
}

ConfigSet is an immutable set of Config, containing at most one Config of each supported type.

func (*ConfigSet) Clear

func (c *ConfigSet) Clear(typ Type)

Clear removes the Config with the provided Type from the ConfigSet, if applicable.

func (ConfigSet) Copy

func (c ConfigSet) Copy() ConfigSet

Copy creates a deep clone of a ConfigSet.

func (ConfigSet) Empty

func (c ConfigSet) Empty() bool

Empty returns true if the ConfigSet is empty.

func (ConfigSet) Get

func (c ConfigSet) Get(typ Type) (Config, bool)

Get looks up the Config with the provided Type and returns it if it exists with the second result indicating presence.

func (*ConfigSet) Set

func (c *ConfigSet) Set(d Config)

Set adds a Config to ConfigSet, overwriting any Config of the same Type.

func (ConfigSet) Strings

func (c ConfigSet) Strings() []string

Strings returns the set of ConfigSet as strings by calling the String method on each Config.

func (ConfigSet) ToSlice

func (c ConfigSet) ToSlice() []Config

ToSlice returns each Config contained in the ConfigSet in a slice.

func (*ConfigSet) UnmarshalTOML

func (c *ConfigSet) UnmarshalTOML(data interface{}) error

UnmarshalTOML implements TOML unmarshaling for ConfigSet.

type DriverConfig

type DriverConfig struct {
	Config
	Dir string
}

type Type

type Type string

Type is a diagnostic type supported by Sweet.

const (
	CPUProfile Type = "cpuprofile"
	MemProfile Type = "memprofile"
	Perf       Type = "perf"
	Trace      Type = "trace"
)

func Types

func Types() []Type

Types returns a slice of all supported types.

func (Type) AsFlag

func (t Type) AsFlag() string

AsFlag returns the Type suitable for use as a CLI flag.

func (Type) IsPprof

func (t Type) IsPprof() bool

IsPprof returns whether the diagnostic's data is stored in the pprof format.

Jump to

Keyboard shortcuts

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