dump

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RoutineLineMatchId           = 1
	RoutineLineMatchType         = 2
	RoutineLineMatchDuration     = 4
	RoutineLineMatchDurationUnit = 5
	RoutineLineMatchLength       = 6
)
View Source
var (
	FunctionLineMatchFullyQualifiedName = 1
	FunctionLineStructContext           = 3
	FunctionLineStructFunction          = 4
	FunctionLineArgAddresses            = 6
	FunctionLineMatchLength             = 7
)
View Source
var (
	LocationLineMatchedFile          = 1
	LocationLineMatchedLine          = 2
	LocationLineMatchedOffsetAddress = 4
	LocationLineMatchedLength        = 5
)
View Source
var Branch = "unknown"
View Source
var BuildDate = "unknown"
View Source
var Commit = "unknown"
View Source
var FunctionLineMatch = regexp.MustCompile(`([ \w\.\/]+)(\((.*?)\))?([\w\.\/]+)?(\((.*?)\))?$`)
View Source
var LocationLineMatch = regexp.MustCompile(`^\t(.*?\.go):(\d+)( \+(.*?))?$`)
View Source
var RoutineLineMatch = regexp.MustCompile(`^goroutine (\d+) \[([\w \.\(\)]+)(, (\d+) (\w+))?]:$`)

RoutineLineMatch is a regex that matches a goroutine line. Check the `waitReasonStrings` variable in `src/runtime/runtime2.go` for the possible wait reasons.

View Source
var Version = "unknown"

Functions

This section is empty.

Types

type Dump

type Dump struct {
	Routines []*Routine
	Stats    *Stats
}

func ParseFile

func ParseFile(filePath string, logger Logger) (*Dump, error)

func ParseScanner

func ParseScanner(scanner *bufio.Scanner, logger Logger) (*Dump, error)

type Frame

type Frame struct {
	Function              string
	ArgumentAddresses     []string
	StructContext         string
	StructContextFunction string
	Path                  string
	Offset                string
	Line                  int
	FunctionLineText      string
	LocationLineText      string

	FileStartLine int
	FileEndLine   int
	UniqueId      string
}

type FunctionLine

type FunctionLine struct {
	FullyQualifiedName string
	ArgAddresses       []string
	Location           *LocationLine
	StructContext      string
	StructFunction     string
}

func ParseFunctionLine

func ParseFunctionLine(line string) (*FunctionLine, error)

type LocationLine

type LocationLine struct {
	UniqueId      string
	File          string
	Line          int
	OffsetAddress string
}

func ParseLocationLine

func ParseLocationLine(line string) (*LocationLine, error)

type LocationStats

type LocationStats struct {
	Count        int
	ShortestWait time.Duration
	LongestWait  time.Duration
}

type Logger

type Logger interface {
	Debug(...interface{})
	Debugf(string, ...interface{})
	Info(...interface{})
	Infof(string, ...interface{})
	Warn(...interface{})
	Warnf(string, ...interface{})
	Error(...interface{})
	Errorf(string, ...interface{})
}

type Routine

type Routine struct {
	*RoutineLine
	Frames []*Frame

	FileStartLine int
	FileEndLine   int
	LineText      string
	AllLines      []string

	StackSignature string
	// contains filtered or unexported fields
}

func (*Routine) Raw

func (r *Routine) Raw() string

type RoutineLine

type RoutineLine struct {
	Id           int
	Type         string
	Duration     string
	DurationUnit string
}

func ParseRoutineLine

func ParseRoutineLine(line string) (*RoutineLine, error)

type RoutineStats

type RoutineStats struct {
	Routines            []*Routine
	RoutinesBySignature map[string][]*Routine //sig -> example routine
}

type Stats

type Stats struct {
	RoutinesByType     *orderedmap.OrderedMap // type -> []*RoutineStats
	RoutinesByFunction *orderedmap.OrderedMap // funcName -> []*RoutineStats
}

func (*Stats) Collect

func (stats *Stats) Collect(routine *Routine)

func (*Stats) GetRoutinesByFunction

func (stats *Stats) GetRoutinesByFunction(name string) *RoutineStats

Jump to

Keyboard shortcuts

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