diagnostics

package
v0.0.0-...-53c1b90 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

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

UnmarshalTOML implements TOML unmarshaling for ConfigSet.

type DriverConfig

type DriverConfig struct {
	ConfigSet
	ResultsDir string
}

DriverConfig is a diagnostics configuration that can be passed to a benchmark driver by serializing to and from command-line flags.

func (*DriverConfig) AddFlags

func (c *DriverConfig) AddFlags(f *flag.FlagSet)

AddFlags populates f with flags that will fill in c.

func (*DriverConfig) DriverArgs

func (c *DriverConfig) DriverArgs() []string

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

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

func (t Type) CanMerge() bool

CanMerge indicates that multiple profiles of this type can be merged into one profile.

func (Type) CanTruncate

func (t Type) CanTruncate() bool

CanTruncate indicates that a truncated diagnostic file of this type is still meaningful.

func (Type) FileName

func (t Type) FileName() string

FileName returns the typical file name suffix for this diagnostic type.

func (Type) HTTPEndpoint

func (t Type) HTTPEndpoint() string

HTTPEndpoint returns the net/http/pprof endpoint for this diagnostic type as a host-relative URL, or "" if there is no enpdoint.

func (Type) IsPprof

func (t Type) IsPprof() bool

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

func (Type) IsSnapshot

func (t Type) IsSnapshot() bool

IsSnapshot indicates that this diagnostic is a point-in-time snapshot that should be collected at the end of a benchmark.

Jump to

Keyboard shortcuts

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