internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModulePath

func ModulePath() string

ModulePath returns the path of the module this pkg belongs to.

func NewFileWriter

func NewFileWriter(name string) io.WriteCloser

NewFileWriter returns a io.WriteCloser.

func WriteNopCloser

func WriteNopCloser(w io.Writer) io.WriteCloser

WriteNopCloser returns an io.WriteCloser that writes to w and does nothing when Close() is called. Go's stdlib unfortunately only provides io.NopCloser for io.Reader, see: https://github.com/golang/go/issues/22823

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder implements a small subset of the "Trace Event Format" spec needed to make fgtrace output data that can be displayed by perfetto.dev. https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview

func NewEncoder

func NewEncoder(w io.Writer) (*Encoder, error)

func (*Encoder) CustomMeta

func (e *Encoder) CustomMeta(name string, value interface{}) error

func (*Encoder) Encode

func (e *Encoder) Encode(ts float64, prev, current *gostackparse.Goroutine) error

func (*Encoder) Finish

func (e *Encoder) Finish() error

type ErrWriter

type ErrWriter struct {
	Err error
}

func (ErrWriter) Write

func (e ErrWriter) Write(p []byte) (int, error)

type Event

type Event struct {
	Name string `json:"name,omitempty"`
	Ph   string `json:"ph,omitempty"`
	// Ts is the tracing clock timestamp of the event. The timestamps are
	// provided at microsecond granularity.
	Ts   float64                `json:"ts"`
	Pid  int64                  `json:"pid,omitempty"`
	Tid  int64                  `json:"tid,omitempty"`
	Args map[string]interface{} `json:"args,omitempty"`
}

type Node

type Node struct {
	Func     string
	Children []*Node
}

func (*Node) HasLeaf

func (n *Node) HasLeaf(fn string) bool

func (*Node) String

func (n *Node) String() string

type TraceData

type TraceData struct {
	Events []*Event
}

func Unmarshal

func Unmarshal(data []byte) (*TraceData, error)

func (*TraceData) CallGraph

func (t *TraceData) CallGraph() *Node

CallGraph returns a graph of all function calls (stack traces) in the trace.

func (*TraceData) Filter

func (t *TraceData) Filter(fn func(*Event) bool) *TraceData

func (*TraceData) Len

func (t *TraceData) Len() int

func (*TraceData) MetaHz

func (t *TraceData) MetaHz() int

Jump to

Keyboard shortcuts

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