elog

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: GPL-2.0, GPL-2.0-or-later Imports: 22 Imported by: 4

Documentation

Overview

High speed event logging

Index

Constants

View Source
const (
	StringRefNil    = StringRef(0)
	SizeofStringRef = unsafe.Sizeof(StringRef(0))
)
View Source
const (
	EventDataBytes = 1<<log2EventBytes - (1*8 + 2*4)
)

Variables

View Source
var DefaultBuffer = New(0)
View Source
var ErrFilterNotFound = errors.New("event filter not found")

Functions

func Add

func Add(d Logger)

func AddData

func AddData(d Data)

func AddDatac

func AddDatac(d Data, c Caller)

func AddDelEventFilter

func AddDelEventFilter(matching string, isDel bool) (err error)

func Addc

func Addc(d Logger, c Caller)

func Clear

func Clear()

func Configure

func Configure(in *parse.Input) (err error)

func DecodeUint32

func DecodeUint32(b []byte, i int) (uint32, int)

func DecodeUint64

func DecodeUint64(b []byte, i int) (uint64, int)

func DisableAfter

func DisableAfter(n uint64)

func Enable

func Enable(v bool)

func Enabled

func Enabled() bool

func EncodeUint32

func EncodeUint32(b []byte, x uint32) int

func EncodeUint64

func EncodeUint64(b []byte, x uint64) int

func F

func F(format string, args ...interface{})

func F1b

func F1b(f string, v bool)

func F1u

func F1u(f string, v uint64)

func F2u

func F2u(f string, v0, v1 uint64)

func Fc

func Fc(format string, c Caller, args ...interface{})

func Fc1b

func Fc1b(f string, c Caller, v bool)

func Fc1u

func Fc1u(f string, c Caller, v uint64)

func Fc2u

func Fc2u(f string, c Caller, v0, v1 uint64)

func GetSequence

func GetSequence() uint64

func GetString

func GetString(si StringRef) string

func HexData

func HexData(p []byte) string

func Len

func Len() (n int)

func Panic

func Panic(err interface{})

Panic adds error to log and saves log file (if configured).

func Print

func Print(w io.Writer, detail bool)

func PrintFilters

func PrintFilters(w io.Writer)

func PrintOnHangupSignal

func PrintOnHangupSignal(w io.Writer, detail bool)

func PutData

func PutData(b []byte, data []byte)

func PutUvarint

func PutUvarint(b []byte, i int) (c []byte)

func ResetFilters

func ResetFilters()

func Resize

func Resize(n uint)

func S

func S(s string)

func SaveFile

func SaveFile(file string) error

func SaveOnHangupSignal

func SaveOnHangupSignal(file string)

func Sc

func Sc(s string, c Caller)

func String

func String(b []byte) string

func StringLen

func StringLen(b []byte) (l int)

func Uvarint

func Uvarint(b []byte) (c []byte, i int)

Types

type Buffer

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

A buffer of events being collected.

func New

func New(log2Len uint) (b *Buffer)

func (*Buffer) Add

func (b *Buffer) Add(d Logger, c Caller)

func (*Buffer) AddData

func (b *Buffer) AddData(d Data, c Caller)

func (*Buffer) AddDelEventFilter

func (b *Buffer) AddDelEventFilter(matching string, isDel bool) (err error)

func (*Buffer) AddTrack

func (b *Buffer) AddTrack(d Logger, c Caller, t uint)

func (*Buffer) Cap

func (b *Buffer) Cap() int

func (*Buffer) Clear

func (b *Buffer) Clear()

func (*Buffer) DisableAfter

func (b *Buffer) DisableAfter(n uint64)

Disable logging after specified number of events have been logged. This is used as a "debug trigger" when a certain target event has occurred. Events will be logged both before and after the target event.

func (*Buffer) Enable

func (b *Buffer) Enable(v bool)

func (*Buffer) Enabled

func (b *Buffer) Enabled() bool

func (*Buffer) F

func (b *Buffer) F(format string, args ...interface{})

func (*Buffer) F1b

func (b *Buffer) F1b(format string, v bool)

func (*Buffer) F1u

func (b *Buffer) F1u(format string, v uint64)

func (*Buffer) F2u

func (b *Buffer) F2u(format string, v0, v1 uint64)

func (*Buffer) Fc

func (b *Buffer) Fc(format string, c Caller, args ...interface{})

func (*Buffer) Fc1b

func (b *Buffer) Fc1b(format string, c Caller, v bool)

func (*Buffer) Fc1u

func (b *Buffer) Fc1u(format string, c Caller, v uint64)

func (*Buffer) Fc2u

func (b *Buffer) Fc2u(format string, c Caller, v0, v1 uint64)

func (*Buffer) GetCaller

func (b *Buffer) GetCaller(a PointerToFirstArg) (c Caller)

func (*Buffer) GetSequence

func (b *Buffer) GetSequence() uint64

func (*Buffer) GetString

func (v *Buffer) GetString(si StringRef) string

func (*Buffer) Len

func (b *Buffer) Len() (n int)

func (*Buffer) NewView

func (b *Buffer) NewView() (v *View)

func (*Buffer) Panic

func (b *Buffer) Panic(err interface{})

Panic adds error to log for given buffer and saves log file (if configured).

func (*Buffer) Print

func (b *Buffer) Print(w io.Writer, detail bool)

func (*Buffer) PrintFilters

func (b *Buffer) PrintFilters(w io.Writer)

func (*Buffer) PrintOnHangupSignal

func (b *Buffer) PrintOnHangupSignal(w io.Writer, detail bool)

Dump log on SIGUP.

func (*Buffer) ResetFilters

func (b *Buffer) ResetFilters()

func (*Buffer) Resize

func (b *Buffer) Resize(n uint)

func (*Buffer) S

func (b *Buffer) S(s string)

func (*Buffer) SaveOnHangupSignal

func (b *Buffer) SaveOnHangupSignal(file string)

func (*Buffer) Sc

func (b *Buffer) Sc(s string, c Caller)

func (*Buffer) SetString

func (v *Buffer) SetString(s string) StringRef

func (*Buffer) SetStringf

func (v *Buffer) SetStringf(format string, args ...interface{}) StringRef

type Caller

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

func GetCaller

func GetCaller(a PointerToFirstArg) (c Caller)

func (*Caller) SetTimeNow

func (c *Caller) SetTimeNow()

type CallerInfo

type CallerInfo struct {
	// Program counter PC value for caller.
	PC uint64
	// Name, Entry and File, Line as returned by runtime.FuncForPC().Name() and friends.
	Name  string
	Entry uint64
	File  string
	Line  int
	// As returned by reflect.Type.Name() etc.
	TypeName    string
	TypePkgPath string
}

func (*CallerInfo) Match

func (c *CallerInfo) Match(re *regexp.Regexp) bool

func (*CallerInfo) ShortPath

func (c *CallerInfo) ShortPath(p string, max uint) (f string, overflow bool)

type Data

type Data interface {
	ElogData() Logger
}

type EventMatch

type EventMatch struct {
	Events []uint
}

type EventTrack

type EventTrack struct {
	Name string
	// contains filtered or unexported fields
}

type Format

type Format func(format string, args ...interface{})

type Log

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

func (*Log) GetString

func (l *Log) GetString(si StringRef) string

func (*Log) Logf

func (l *Log) Logf(format string, args ...interface{})

type Logger

type Logger interface {
	Elog(l *Log)
}

type Pointer

type Pointer unsafe.Pointer

type PointerToFirstArg

type PointerToFirstArg unsafe.Pointer

type StringRef

type StringRef uint32

func SetString

func SetString(s string) StringRef

func SetStringf

func SetStringf(format string, args ...interface{}) StringRef

type View

type View struct {
	Times viewTimes
	// contains filtered or unexported fields
}

func NewView

func NewView() *View

func (*View) ElapsedTime

func (v *View) ElapsedTime(e *eventHeader) float64

Elapsed time since view start time.

func (*View) Event

func (v *View) Event(i uint) *eventHeader

func (*View) EventCaller

func (v *View) EventCaller(i uint) (c *CallerInfo)

func (*View) EventLines

func (v *View) EventLines(i uint) (s []string)

func (*View) EventsMatching

func (v *View) EventsMatching(matching string, events0 []uint) (events []uint, err error)

func (*View) GetString

func (v *View) GetString(si StringRef) string

func (*View) LoadFile

func (v *View) LoadFile(file string) (err error)

func (*View) MarshalBinary

func (v *View) MarshalBinary() ([]byte, error)

func (*View) Name

func (v *View) Name() string

func (*View) NumEvents

func (v *View) NumEvents() uint

func (*View) Print

func (v *View) Print(w io.Writer, verbose bool)

func (*View) PrintEvents

func (v *View) PrintEvents(w io.Writer, es []uint, verbose bool)

func (*View) Reset

func (v *View) Reset()

func (*View) Restore

func (v *View) Restore(r io.Reader) (err error)

func (*View) Save

func (v *View) Save(w io.Writer) (err error)

func (*View) SaveFile

func (v *View) SaveFile(file string) (err error)

func (*View) SetName

func (v *View) SetName(name string)

func (*View) SetString

func (v *View) SetString(s string) StringRef

func (*View) SetStringf

func (v *View) SetStringf(format string, args ...interface{}) StringRef

func (*View) SubView

func (v *View) SubView(t0, t1 float64) (n uint)

Make subview with only events between elapsed times t0 and t1.

func (*View) UnmarshalBinary

func (v *View) UnmarshalBinary(b []byte) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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