Documentation ¶
Index ¶
- Constants
- Variables
- func GetHostByteOrder() binary.ByteOrder
- func RandomStringWithLen(n int) string
- type BinaryCookie
- type CombinedID
- type Func
- type FuncID
- type FuncType
- type Options
- type Report
- type StackID
- type StackTrace
- type StackTraceCount
- type StackTraceNode
- type SymbolAddr
- type TraceEvent
- type TracedBinary
- type TracedSymbol
- type UTrace
- func (u *UTrace) ResolveKernelSymbolAndOffset(address SymbolAddr) StackTraceNode
- func (u *UTrace) ResolveUserSymbolAndOffset(address SymbolAddr, binary *TracedBinary) StackTraceNode
- func (u *UTrace) Start() error
- func (u *UTrace) Stop() (Report, error)
- func (u *UTrace) TraceEventsHandler(Cpu int, data []byte, perfMap *manager.PerfMap, m *manager.Manager)
Constants ¶
const ( // MaxUserSymbolsCount is the max number of symbols probed at the same time MaxUserSymbolsCount = uint32(100) // MaxKernelSymbolsCount is the max number of kernel symbols probed at the same time MaxKernelSymbolsCount = uint32(500) )
const PathMax = 350
PathMax - Maximum path length of the binary path handled by utrace
Variables ¶
var ( // NotEnoughDataErr indicates that the data retrieved from the perf map is not long enough NotEnoughDataErr = errors.New("not enough data") // EmptyPatternsErr indicates that both the kernel function and userspace symbol patterns are empty EmptyPatternsErr = errors.New("empty patterns") // EmptyBinaryPathErr indicates that a userspace symbol pattern was provided but without a binary path EmptyBinaryPathErr = errors.New("empty binary path") // NoPatternProvidedErr indicates that no function pattern was provided NoPatternProvidedErr = errors.New("no function pattern or hook point was provided") )
var ByteOrder binary.ByteOrder
ByteOrder holds the hosts byte order
var ( // SymbolNotFound is used to notify that a symbol could not be resolved SymbolNotFound = elf.Symbol{Name: "[symbol_not_found]"} )
Functions ¶
func GetHostByteOrder ¶
GetHostByteOrder guesses the hosts byte order
func RandomStringWithLen ¶
RandomStringWithLen returns a random string of specified length containing upper- and lowercase runes.
Types ¶
type BinaryCookie ¶
type BinaryCookie uint32
BinaryCookie is a unique identifier used to select a TracedBinary
type CombinedID ¶
type CombinedID uint64
CombinedID is a unique identifier used to select a combined stack trace (user and kernel)
type Func ¶
type Func struct { Type FuncType Symbol elf.Symbol Count uint64 AverageLatency time.Duration Binary *TracedBinary // contains filtered or unexported fields }
Func contains the data collected by utrace for a function
func NewFunc ¶
func NewFunc(symbol elf.Symbol, binary *TracedBinary) Func
NewFunc instanciates a new Func
func (*Func) GetStackTrace ¶
func (f *Func) GetStackTrace(stackID CombinedID) *StackTrace
GetStackTrace returns a stack trace from its StackID
func (*Func) GetStackTracesByHits ¶
func (f *Func) GetStackTracesByHits() []*StackTrace
GetStackTracesByHits returns the list of stack traces by hits count
type Options ¶
type Options struct { FuncPattern *regexp.Regexp KernelFuncPattern *regexp.Regexp Tracepoints []string PerfEvents []string Latency bool StackTraces bool Binary []string PIDFilter []int }
Options contains the parameters of UTrace
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
Report contains the statistics generated by UTRace
func (*Report) GetDuration ¶
GetDuration returns the duration of the trace
func (*Report) GetFunctionsByHits ¶
func (r *Report) GetFunctionsByHits() map[BinaryCookie][]Func
GetFunctionsByHits returns the list of traced functions ordered by their hits count
func (*Report) GetFunctionsByLatency ¶
func (r *Report) GetFunctionsByLatency() map[BinaryCookie][]Func
GetFunctionsByLatency returns the list of traced functions ordered by their latency
func (*Report) GetStackTraceCount ¶
func (r *Report) GetStackTraceCount() StackTraceCount
GetStackTraceCount returns the total number of stack traces collected from the kernel
type StackTrace ¶
type StackTrace struct { Count int Binary *TracedBinary UserStacktrace []StackTraceNode KernelStackTrace []StackTraceNode }
StackTrace contains the ordered list of symbols of a stack trace
func NewStackTrace ¶
func NewStackTrace(count int, binary *TracedBinary) *StackTrace
NewStackTrace returns a new StackTrace initialized with the provided count
type StackTraceCount ¶
StackTraceCount holds the amount of traces that were collected or lost
type StackTraceNode ¶
type StackTraceNode struct { Type FuncType FuncID FuncID Offset SymbolAddr Symbol elf.Symbol }
StackTraceNode represents a node of a stack trace
type TraceEvent ¶
type TraceEvent struct { Pid uint32 Tid uint32 UserStackID StackID KernelStackID StackID FuncID FuncID Cookie BinaryCookie }
TraceEvent is a kernel trace event retrieved from a perf map
func (*TraceEvent) UnmarshalBinary ¶
func (te *TraceEvent) UnmarshalBinary(data []byte) (int, error)
UnmarshalBinary unmarshals the binary representation of a trace event
type TracedBinary ¶
type TracedSymbol ¶
type TracedSymbol struct {
// contains filtered or unexported fields
}
type UTrace ¶
type UTrace struct { // TracedBinaries is the list of userspace binaries for which we are collecting stack traces TracedBinaries map[BinaryCookie]*TracedBinary // contains filtered or unexported fields }
UTrace is the main UTrace structure
func (*UTrace) ResolveKernelSymbolAndOffset ¶
func (u *UTrace) ResolveKernelSymbolAndOffset(address SymbolAddr) StackTraceNode
ResolveKernelSymbolAndOffset returns the symbol of the kernel function in which a given address lives, as well as the offset inside that function
func (*UTrace) ResolveUserSymbolAndOffset ¶
func (u *UTrace) ResolveUserSymbolAndOffset(address SymbolAddr, binary *TracedBinary) StackTraceNode
ResolveUserSymbolAndOffset returns the symbol of the function in which a given address lives, as well as the offset inside that function