Structs
Event
struct
#
Event is a simple representation of a trace event.
Note that this typically includes much more than just
timestamped events, and it also represents parts of the
trace format's framing. (But not interpreted.)
type Event struct {
Version version.Version
Ev event.Type
Args []uint64
Data []byte
}
Reader
struct
#
Reader parses trace bytes with only very basic validation
into an event stream.
type Reader struct {
r *bufio.Reader
v version.Version
specs []event.Spec
}
TextReader
struct
#
TextReader parses a text format trace with only very basic validation
into an event stream.
type TextReader struct {
v version.Version
specs []event.Spec
names map[string]event.Type
s *bufio.Scanner
}
TextWriter
struct
#
TextWriter emits the text format of a trace.
type TextWriter struct {
w io.Writer
v version.Version
}
Writer
struct
#
Writer emits the wire format of a trace.
It may not produce a byte-for-byte compatible trace from what is
produced by the runtime, because it may be missing extra padding
in the LEB128 encoding that the runtime adds but isn't necessary
when you know the data up-front.
type Writer struct {
w io.Writer
buf []byte
v version.Version
specs []event.Spec
}
Functions
EncodedSize
method
#
EncodedSize returns the canonical encoded size of an event.
func (e *Event) EncodedSize() int
NewReader
function
#
NewReader creates a new reader for the trace wire format.
func NewReader(r io.Reader) (*Reader, error)
NewTextReader
function
#
NewTextReader creates a new reader for the trace text format.
func NewTextReader(r io.Reader) (*TextReader, error)
NewTextWriter
function
#
NewTextWriter creates a new write for the trace text format.
func NewTextWriter(w io.Writer, v version.Version) (*TextWriter, error)
NewWriter
function
#
NewWriter creates a new byte format writer.
func NewWriter(w io.Writer, v version.Version) (*Writer, error)
ReadEvent
method
#
ReadEvent reads and returns the next trace event in the byte stream.
func (r *Reader) ReadEvent() (Event, error)
ReadEvent
method
#
ReadEvent reads and returns the next trace event in the text stream.
func (r *TextReader) ReadEvent() (Event, error)
String
method
#
String returns the canonical string representation of the event.
This format is the same format that is parsed by the TextReader
and emitted by the TextWriter.
func (e *Event) String() string
Version
method
#
Version returns the version of the trace that we're reading.
func (r *Reader) Version() version.Version
Version
method
#
Version returns the version of the trace that we're reading.
func (r *TextReader) Version() version.Version
WriteEvent
method
#
WriteEvent writes a single event to the stream.
func (w *TextWriter) WriteEvent(e Event) error
WriteEvent
method
#
WriteEvent writes a single event to the trace wire format stream.
func (w *Writer) WriteEvent(e Event) error
nextLine
method
#
func (r *TextReader) nextLine() (string, error)
readArg
function
#
func readArg(s string) (arg string, value uint64, rest string, err error)
readArgs
function
#
func readArgs(s string, names []string) ([]uint64, error)
readArgs
method
#
func (r *Reader) readArgs(n int) ([]uint64, error)
readData
function
#
func readData(line string) ([]byte, error)
readData
method
#
func (r *Reader) readData() ([]byte, error)
readToken
function
#
func readToken(s string) (token string, rest string)