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 }
func (e *Event) String() string
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.
Reader parses trace bytes with only very basic validation into an event stream.
type Reader struct {
// contains filtered or unexported fields
}
func NewReader(r io.Reader) (*Reader, error)
NewReader creates a new reader for the trace wire format.
func (r *Reader) ReadEvent() (Event, error)
ReadEvent reads and returns the next trace event in the byte stream.
func (r *Reader) Version() version.Version
Version returns the version of the trace that we're reading.
TextReader parses a text format trace with only very basic validation into an event stream.
type TextReader struct {
// contains filtered or unexported fields
}
func NewTextReader(r io.Reader) (*TextReader, error)
NewTextReader creates a new reader for the trace text format.
func (r *TextReader) ReadEvent() (Event, error)
ReadEvent reads and returns the next trace event in the text stream.
func (r *TextReader) Version() version.Version
Version returns the version of the trace that we're reading.
TextWriter emits the text format of a trace.
type TextWriter struct {
// contains filtered or unexported fields
}
func NewTextWriter(w io.Writer, v version.Version) (*TextWriter, error)
NewTextWriter creates a new write for the trace text format.
func (w *TextWriter) WriteEvent(e Event) error
WriteEvent writes a single event to the stream.
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 {
// contains filtered or unexported fields
}
func NewWriter(w io.Writer, v version.Version) (*Writer, error)
NewWriter creates a new byte format writer.
func (w *Writer) WriteEvent(e Event) error
WriteEvent writes a single event to the trace wire format stream.