traceparser

package
v0.24.78 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 2 Imported by: 0

README

Benchmark results

goos: windows
goarch: amd64
pkg: github.com/getsentry/sentry-go/internal/trace
cpu: 12th Gen Intel(R) Core(TM) i7-12700K
BenchmarkEqualBytes-20                  44323621                26.08 ns/op
BenchmarkStringEqual-20                 60980257                18.27 ns/op
BenchmarkEqualPrefix-20                 41369181                31.12 ns/op
BenchmarkFullParse-20                     702012              1507 ns/op        1353.42 MB/s        1024 B/op          6 allocs/op
BenchmarkFramesIterator-20               1229971               969.3 ns/op           896 B/op          5 allocs/op
BenchmarkFramesReversedIterator-20       1271061               944.5 ns/op           896 B/op          5 allocs/op
BenchmarkSplitOnly-20                    2250800               534.0 ns/op      3818.23 MB/s         128 B/op          1 allocs/op

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

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

func (*Frame) File

func (f *Frame) File() (path []byte, lineNumber int)

func (*Frame) Func

func (f *Frame) Func() []byte

func (*Frame) UniqueIdentifier

func (f *Frame) UniqueIdentifier() []byte

UniqueIdentifier can be used as a map key to identify the frame.

type FrameIterator

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

FrameIterator iterates over stack frames.

func (*FrameIterator) HasNext

func (it *FrameIterator) HasNext() bool

HasNext return true if there are values to be read.

func (*FrameIterator) LengthUpperBound

func (it *FrameIterator) LengthUpperBound() int

LengthUpperBound returns the maximum number of elements this stacks may contain. The actual number may be lower because of elided frames. As such, the returned value cannot be used to iterate over the frames but may be used to reserve capacity.

func (*FrameIterator) Next

func (it *FrameIterator) Next() Frame

Next returns the next frame, or nil if there are none.

type ReverseFrameIterator

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

ReverseFrameIterator iterates over stack frames in reverse order.

func (*ReverseFrameIterator) HasNext

func (it *ReverseFrameIterator) HasNext() bool

HasNext return true if there are values to be read.

func (*ReverseFrameIterator) LengthUpperBound

func (it *ReverseFrameIterator) LengthUpperBound() int

LengthUpperBound returns the maximum number of elements this stacks may contain. The actual number may be lower because of elided frames. As such, the returned value cannot be used to iterate over the frames but may be used to reserve capacity.

func (*ReverseFrameIterator) Next

func (it *ReverseFrameIterator) Next() Frame

Next returns the next frame, or nil if there are none.

type Trace

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

Trace represents a single stacktrace block, identified by a Goroutine ID and a sequence of Frames.

func (*Trace) Frames

func (t *Trace) Frames() FrameIterator

func (*Trace) FramesReversed

func (t *Trace) FramesReversed() ReverseFrameIterator

func (*Trace) GoID

func (t *Trace) GoID() (id uint64)

GoID parses the Goroutine ID from the header.

func (*Trace) UniqueIdentifier

func (t *Trace) UniqueIdentifier() []byte

UniqueIdentifier can be used as a map key to identify the trace.

type TraceCollection

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

func Parse

func Parse(data []byte) TraceCollection

Parses multi-stacktrace text dump produced by runtime.Stack([]byte, all=true). The parser prioritizes performance but requires the input to be well-formed in order to return correct data. See https://github.com/golang/go/blob/go1.20.4/src/runtime/mprof.go#L1191

func (*TraceCollection) Item

func (it *TraceCollection) Item(i int) Trace

Returns the stacktrace item at the given index.

func (TraceCollection) Length

func (it TraceCollection) Length() int

Jump to

Keyboard shortcuts

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