Imports #
"context"
"encoding/json"
"errors"
"internal/trace/traceviewer/format"
"os"
"strings"
"sync/atomic"
"time"
"context"
"encoding/json"
"errors"
"internal/trace/traceviewer/format"
"os"
"strings"
"sync/atomic"
"time"
Constants used in event fields. See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU for more details.
const bindEnclosingSlice = "e"
Constants used in event fields. See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU for more details.
const phaseDurationBegin = "B"
Constants used in event fields. See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU for more details.
const phaseDurationEnd = "E"
Constants used in event fields. See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU for more details.
const phaseFlowEnd = "f"
Constants used in event fields. See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU for more details.
const phaseFlowStart = "s"
var traceStarted atomic.Bool
type Span struct {
t *tracer
name string
tid uint64
start time.Time
end time.Time
}
type traceContext struct {
t *tracer
tid uint64
}
type traceFile struct {
f *os.File
sb *strings.Builder
enc *json.Encoder
entries int64
}
traceKey is the context key for tracing information. It is unexported to prevent collisions with context keys defined in other packages.
type traceKey struct {
}
type tracer struct {
file chan traceFile
nextTID atomic.Uint64
nextFlowID atomic.Uint64
}
func (t *tracer) Close() error
func (s *Span) Done()
Flow marks a flow indicating that the 'to' span depends on the 'from' span. Flow should be called while the 'to' span is in progress.
func Flow(ctx context.Context, from *Span, to *Span)
Start starts a trace which writes to the given file.
func Start(ctx context.Context, file string) (context.Context, func() error, error)
StartGoroutine associates the context with a new Thread ID. The Chrome trace viewer associates each trace event with a thread, and doesn't expect events with the same thread id to happen at the same time.
func StartGoroutine(ctx context.Context) context.Context
StartSpan starts a trace event with the given name. The Span ends when its Done method is called.
func StartSpan(ctx context.Context, name string) (context.Context, *Span)
func (t *tracer) getNextFlowID() uint64
func (t *tracer) getNextTID() uint64
func getTraceContext(ctx context.Context) (traceContext, bool)
func (t *tracer) writeEvent(ev *format.Event) error
Generated with Arrow