timing

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MinNestedSpan = 5 * time.Millisecond

MinNestedSpan defines the minimum duration for nested spans to not be elided.

Functions

This section is empty.

Types

type Span

type Span struct {
	Label   string            `json:"label,omitempty"`
	Summary string            `json:"summary,omitempty"`
	Depth   int               `json:"depth,omitempty"`
	Spans   []*Span           `json:"spans,omitempty"`
	Tags    map[string]string `json:"tags,omitempty"`
	Base    uint64            `json:"base,omitempty"`
	A       uint64            `json:"a,omitempty"`
	B       uint64            `json:"b,omitempty"`
	// contains filtered or unexported fields
}

Span represents a measured time span with optional nested measurements. The span lasts from A to B, which are both deltas in nanoseconds since the root's Base, which is itself the number of seconds since unix epoch.

func Start

func Start(label, summary string, tags map[string]string) *Span

Start starts a timing span object. Tags provide information to identify the timing when retrieving or observing it.

func (*Span) MarshalJSON

func (s *Span) MarshalJSON() ([]byte, error)

func (*Span) StartNested

func (s *Span) StartNested(label, summary string) *Span

StartNested starts a nested time span measurement which stops when the returned span's Stop method is called.

func (*Span) Stop

func (s *Span) Stop()

Stop stops the measurement.

func (*Span) Tag

func (s *Span) Tag(tag, value string)

Tag decorates the span with a tag for retrieving and observing it.

Jump to

Keyboard shortcuts

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