event

package standard library
go1.23.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArgTypes = [...]string{
	"seq",
	"pstatus",
	"gstatus",
	"g",
	"m",
	"p",
	"string",
	"stack",
	"value",
	"task",
}

ArgTypes is a list of valid argument types for use in Args.

See the documentation of Args for more details.

View Source
var UserGoReqs = SchedReqs{Thread: MustHave, Proc: MustHave, Goroutine: MustHave}

UserGoReqs is a common requirement among events that are running or are close to running user code.

Functions

func Names

func Names(specs []Spec) map[string]Type

Names is a helper that produces a mapping of event names to event types.

Types

type Constraint

type Constraint uint8

Constraint represents a various presence requirements.

const (
	MustNotHave Constraint = iota
	MayHave
	MustHave
)

type Experiment

type Experiment uint

Experiment is an experiment ID that events may be associated with.

const NoExperiment Experiment = 0

NoExperiment is the reserved ID 0 indicating no experiment.

type SchedReqs

type SchedReqs struct {
	Thread    Constraint
	Proc      Constraint
	Goroutine Constraint
}

SchedReqs is a set of constraints on what the scheduling context must look like.

type Spec

type Spec struct {
	// Name is the human-readable name of the trace event.
	Name string

	// Args contains the names of each trace event's argument.
	// Its length determines the number of arguments an event has.
	//
	// Argument names follow a certain structure and this structure
	// is relied on by the testing framework to type-check arguments.
	// The structure is is:
	//
	//     (?P<name>[A-Za-z]+_)?(?P<type>[A-Za-z]+)
	//
	// In sum, it's an optional name followed by a type. If the name
	// is present, it is separated from the type with an underscore.
	// The valid argument types and the Go types they map to are listed
	// in the ArgTypes variable.
	Args []string

	// StringIDs indicates which of the arguments are string IDs.
	StringIDs []int

	// StackIDs indicates which of the arguments are stack IDs.
	//
	// The list is not sorted. The first index always refers to
	// the main stack for the current execution context of the event.
	StackIDs []int

	// StartEv indicates the event type of the corresponding "start"
	// event, if this event is an "end," for a pair of events that
	// represent a time range.
	StartEv Type

	// IsTimedEvent indicates whether this is an event that both
	// appears in the main event stream and is surfaced to the
	// trace reader.
	//
	// Events that are not "timed" are considered "structural"
	// since they either need significant reinterpretation or
	// otherwise aren't actually surfaced by the trace reader.
	IsTimedEvent bool

	// HasData is true if the event has trailer consisting of a
	// varint length followed by unencoded bytes of some data.
	//
	// An event may not be both a timed event and have data.
	HasData bool

	// IsStack indicates that the event represents a complete
	// stack trace. Specifically, it means that after the arguments
	// there's a varint length, followed by 4*length varints. Each
	// group of 4 represents the PC, file ID, func ID, and line number
	// in that order.
	IsStack bool

	// Experiment indicates the ID of an experiment this event is associated
	// with. If Experiment is not NoExperiment, then the event is experimental
	// and will be exposed as an EventExperiment.
	Experiment Experiment
}

Spec is a specification for a trace event. It contains sufficient information to perform basic parsing of any trace event for any version of Go.

type Type

type Type uint8

Type is the common in-memory representation of the low-leve

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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