cluster

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllRunning

func AllRunning(root *Span) (run, net [][2]int64, runSum int64)

AllRunning returns time ranges relative to the Span's start when any children of the span were running and when any children of the span were blocked on the network.

func Visit

func Visit(span *Span, fn func(span *Span))

Types

type Ranges

type Ranges struct {
	Running   [][2]int64
	Assisting map[string][][2]int64
	Waiting   map[string][][2]int64
}

func Running

func Running(span *Span) (*Ranges, error)

Running returns time ranges relative to the Span's start when the Span was running, when it was blocked for various reasons, and when it was doing assist work.

type Span

type Span struct {
	// G is the id of the goroutine that executed this Span
	G uint64
	// Kind names this type of Span
	Kind string
	// StartNs is the start time of this Span measured in nanoseconds.
	StartNs int64
	// LengthNs is the duration of this Span measured in nanoseconds.
	LengthNs int64

	// StartRun is a list of times when the goroutine started running. It is
	// measured in nanoseconds relative to StartNs.
	StartRun []int64

	// StartAssist describes the starts of stretches of time when the goroutine
	// was running, but was not running its own code. An entry in the "gc" list
	// here describes when the goroutine started doing GC Assist work.
	StartAssist map[string][]int64

	// StartWait describes the starts of stretches of time when the goroutine
	// was not running because it was waiting for some kind of event. An entry
	// in the "net" list here describes when the goroutine started blocking
	// because it needed to read data from the network. An entry in the "cpu"
	// list here describes when the goroutine becomes runnable.
	StartWait map[string][]int64

	// Caused lists Spans that this Span caused to exist.
	Caused []*Span
}

A Span describes a single goroutine's contribution of a unit of useful work.

func ExtractSpans

func ExtractSpans(data *internal.Data, findRegions func([]*trace.Event) []*internal.Region) []*Span

type TreeSummary

type TreeSummary struct {
	// LengthNs is the duration of this tree of Spans measured in nanoseconds.
	LengthNs int64

	// TotalRunNs is the total amount of CPU time these Spans consumed.
	TotalRunNs int64
	// TotalAssistNs is the total amount of CPU time these Spans spent doing
	// non-application work.
	TotalAssistNs map[string]int64

	// FlatRunNs is the amount of wall-clock time attributable to on-CPU time.
	//
	// When collapsing a set of timelines (one for each Span) into a single
	// timeline, time ranges where any Span was on-CPU counts as on-CPU time in
	// the single flattened timeline.
	//
	// Similarly, time ranges there at least one Span was doing assist work
	// counts as time doing assist work in the flattened view, in addition to
	// being on-CPU time. Priority for attributing assist work starts with "gc"
	// assist.
	//
	// Time ranges where every Span is waiting are counted as waiting in the
	// flat view. Priority is as follows:
	//  - "cpu" is first, to follow the high preference given to on-CPU time.
	//  - "gc" is second, again because it's getting in the way of what would be on-CPU time.
	//  - "net", as it's likely to represent forces outside of the process.
	//  - "syscall", again because it's likely to show us interesting cross-process waiting.
	//  - Finally, process-internal synchronization: "select", "recv", "send", "cond", "sync", "block".
	FlatRunNs    int64
	FlatAssistNs map[string]int64
	FlatWaitNs   map[string]int64

	Flat *Span
	Root *Span
}

A TreeSummary describes the overall behavior of a tree of Spans.

func Summarize

func Summarize(root *Span) *TreeSummary

Jump to

Keyboard shortcuts

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