package trace

Import Path
	internal/trace (on golang.org and go.dev)

Dependency Relation
	imports 16 packages, and imported by 0 packages

Involved Source Files
	    gc.go
	    goroutines.go
	    mud.go
	    order.go
	    parser.go
	    writer.go

Exported Type Names

type Event (struct) Event describes one event in the trace. Args [3]uint64 G uint64 Link *Event Off int P int SArgs []string Stk []*Frame StkID uint64 Ts int64 Type byte (*T) String() string *T : expvar.Var *T : fmt.Stringer func GoroutineStats(events []*Event) map[uint64]*GDesc func MutatorUtilization(events []*Event, flags UtilFlags) [][]MutatorUtil func Print(events []*Event) func PrintEvent(ev *Event) func RelatedGoroutines(events []*Event, goid uint64) map[uint64]bool
type Frame (struct) Frame is a frame in stack traces. File string Fn string Line int PC uint64
type GExecutionStat (struct) GExecutionStat contains statistics about a goroutine's execution during a period of time. BlockTime int64 ExecTime int64 GCTime int64 IOTime int64 SchedWaitTime int64 SweepTime int64 SyscallTime int64 TotalTime int64
type MMUCurve (struct) An MMUCurve is the minimum mutator utilization curve across multiple window sizes. (*T) Examples(window time.Duration, n int) (worst []UtilWindow) (*T) MMU(window time.Duration) (mmu float64) (*T) MUD(window time.Duration, quantiles []float64) []float64 func NewMMUCurve(utils [][]MutatorUtil) *MMUCurve
type MutatorUtil (struct) MutatorUtil is a change in mutator utilization at a particular time. Mutator utilization functions are represented as a time-ordered []MutatorUtil. Time int64 Util float64 func MutatorUtilization(events []*Event, flags UtilFlags) [][]MutatorUtil func NewMMUCurve(utils [][]MutatorUtil) *MMUCurve
type ParseResult (struct) ParseResult is the result of Parse. Events []*Event Stacks map[uint64][]*Frame func Parse(r io.Reader, bin string) (ParseResult, error)
type UtilFlags int UtilFlags controls the behavior of MutatorUtilization. func MutatorUtilization(events []*Event, flags UtilFlags) [][]MutatorUtil const UtilAssist const UtilBackground const UtilPerProc const UtilSTW const UtilSweep
type UtilWindow (struct) UtilWindow is a specific window at Time. MutatorUtil float64 Time int64 func (*MMUCurve).Examples(window time.Duration, n int) (worst []UtilWindow)
type Writer (struct) Writer is a test trace writer. Buffer bytes.Buffer (*T) Bytes() []byte (*T) Cap() int (*T) Emit(typ byte, args ...uint64) (*T) Grow(n int) (*T) Len() int (*T) Next(n int) []byte (*T) Read(p []byte) (n int, err error) (*T) ReadByte() (byte, error) (*T) ReadBytes(delim byte) (line []byte, err error) (*T) ReadFrom(r io.Reader) (n int64, err error) (*T) ReadRune() (r rune, size int, err error) (*T) ReadString(delim byte) (line string, err error) (*T) Reset() (*T) String() string (*T) Truncate(n int) (*T) UnreadByte() error (*T) UnreadRune() error (*T) Write(p []byte) (n int, err error) (*T) WriteByte(c byte) error (*T) WriteRune(r rune) (n int, err error) (*T) WriteString(s string) (n int, err error) (*T) WriteTo(w io.Writer) (n int64, err error) *T : compress/flate.Reader *T : expvar.Var *T : fmt.Stringer *T : image/jpeg.Reader *T : io.ByteReader *T : io.ByteScanner *T : io.ByteWriter *T : io.Reader *T : io.ReaderFrom *T : io.ReadWriter *T : io.RuneReader *T : io.RuneScanner *T : io.StringWriter *T : io.Writer *T : io.WriterTo func NewWriter() *Writer
Exported Values
var BreakTimestampsForTesting bool BreakTimestampsForTesting causes the parser to randomly alter timestamps (for testing of broken cputicks).
var ErrTimeOrder error ErrTimeOrder is returned by Parse when the trace contains time stamps that do not respect actual event ordering.
const EvBatch = 1 // start of per-P batch of events [pid, timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvCount = 49 Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
var EventDescriptions [49]struct{Name string; minVersion int; Stack bool; Args []string; SArgs []string}
const EvFrequency = 2 // contains tracer timer frequency [frequency (ticks per second)] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvFutileWakeup = 36 // denotes that the previous wakeup of this goroutine was futile [timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCDone = 8 // GC done [timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCMarkAssistDone = 44 // GC mark assist done [timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCMarkAssistStart = 43 // GC mark assist start [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCStart = 7 // GC start [timestamp, seq, stack id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCSTWDone = 10 // GC mark termination done [timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCSTWStart = 9 // GC mark termination start [timestamp, kind] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCSweepDone = 12 // GC sweep done [timestamp, swept, reclaimed] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGCSweepStart = 11 // GC sweep start [timestamp, stack id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlock = 20 // goroutine blocks [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlockCond = 26 // goroutine blocks on Cond [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlockGC = 42 // goroutine blocks on GC assist [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlockNet = 27 // goroutine blocks on network [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlockRecv = 23 // goroutine blocks on chan recv [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlockSelect = 24 // goroutine blocks on select [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlockSend = 22 // goroutine blocks on chan send [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoBlockSync = 25 // goroutine blocks on Mutex/RWMutex [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoCreate = 13 // goroutine creation [timestamp, new goroutine id, new stack id, stack id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoEnd = 15 // goroutine ends [timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoInSyscall = 32 // denotes that goroutine is in syscall when tracing starts [timestamp, goroutine id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGomaxprocs = 4 // current value of GOMAXPROCS [timestamp, GOMAXPROCS, stack id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoPreempt = 18 // goroutine is preempted [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoSched = 17 // goroutine calls Gosched [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoSleep = 19 // goroutine calls Sleep [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoStart = 14 // goroutine starts running [timestamp, goroutine id, seq] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoStartLabel = 41 // goroutine starts running with label [timestamp, goroutine id, seq, label string id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoStartLocal = 38 // goroutine starts running on the same P as the last event [timestamp, goroutine id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoStop = 16 // goroutine stops (like in select{}) [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoSysBlock = 30 // syscall blocks [timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoSysCall = 28 // syscall enter [timestamp, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoSysExit = 29 // syscall exit [timestamp, goroutine id, seq, real timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoSysExitLocal = 40 // syscall exit on the same P as the last event [timestamp, goroutine id, real timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoUnblock = 21 // goroutine is unblocked [timestamp, goroutine id, seq, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoUnblockLocal = 39 // goroutine is unblocked on the same P as the last event [timestamp, goroutine id, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvGoWaiting = 31 // denotes that goroutine is blocked when tracing starts [timestamp, goroutine id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvHeapAlloc = 33 // memstats.heap_live change [timestamp, heap_alloc] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvNextGC = 34 // memstats.next_gc change [timestamp, next_gc] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvNone = 0 // unused Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvProcStart = 5 // start of P [timestamp, thread id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvProcStop = 6 // stop of P [timestamp] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvStack = 3 // stack [stack id, number of PCs, array of {PC, func string ID, file string ID, line}] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvString = 37 // string dictionary entry [ID, length, string] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvTimerGoroutine = 35 // denotes timer goroutine [timer goroutine id] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvUserLog = 48 // trace.Log [timestamp, internal id, key string id, stack, value string] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvUserRegion = 47 // trace.WithRegion [timestamp, internal task id, mode(0:start, 1:end), stack, name string] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvUserTaskCreate = 45 // trace.NewContext [timestamp, internal task id, internal parent id, stack, name string] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const EvUserTaskEnd = 46 // end of task [timestamp, internal task id, stack] Event types in the trace. Verbatim copy from src/runtime/trace.go with the "trace" prefix removed.
const FakeP = 1000000 Special P identifiers:
const GCP = 1000004 // depicts GC state
func GoroutineStats(events []*Event) map[uint64]*GDesc GoroutineStats generates statistics for all goroutines in the trace.
func MutatorUtilization(events []*Event, flags UtilFlags) [][]MutatorUtil MutatorUtilization returns a set of mutator utilization functions for the given trace. Each function will always end with 0 utilization. The bounds of each function are implicit in the first and last event; outside of these bounds each function is undefined. If the UtilPerProc flag is not given, this always returns a single utilization function. Otherwise, it returns one function per P.
const NetpollP = 1000002 // depicts network unblocks
func NewMMUCurve(utils [][]MutatorUtil) *MMUCurve NewMMUCurve returns an MMU curve for the given mutator utilization function.
func NewWriter() *Writer
func Parse(r io.Reader, bin string) (ParseResult, error) Parse parses, post-processes and verifies the trace.
func Print(events []*Event) Print dumps events to stdout. For debugging.
func PrintEvent(ev *Event) PrintEvent dumps the event to stdout. For debugging.
func RelatedGoroutines(events []*Event, goid uint64) map[uint64]bool RelatedGoroutines finds a set of goroutines related to goroutine goid.
const SyscallP = 1000003 // depicts returns from syscalls
const TimerP = 1000001 // depicts timer unblocks
const UtilAssist UtilFlags = 4 UtilAssist means utilization should account for mark assists.
const UtilBackground UtilFlags = 2 UtilBackground means utilization should account for background mark workers.
const UtilPerProc UtilFlags = 16 UtilPerProc means each P should be given a separate utilization function. Otherwise, there is a single function and each P is given a fraction of the utilization.
const UtilSTW UtilFlags = 1 UtilSTW means utilization should account for STW events.
const UtilSweep UtilFlags = 8 UtilSweep means utilization should account for sweeping.