stack

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const NilG = G(uintptr(0)) // nil

Variables

View Source
var InitGStack = &Stack{}

InitGStack special stack during init

View Source
var NilGStack = &Stack{}

NilGStack is a guard pointer for when g is nil because m is just starting on g0

Functions

func Attach

func Attach(stack *Stack)

Attach attaches a stack for recording

func Detach

func Detach()

func Export

func Export(stack *Stack, offsetNS int64) *stack_model.Stack

func ExportFuncInfo

func ExportFuncInfo(entry *Entry) *stack_model.FuncInfo

func ExportStackEntries

func ExportStackEntries(entries []*Entry, rootBegin time.Time, offsetNS int64) []*stack_model.StackEntry

func ExportStackEntry

func ExportStackEntry(entry *Entry, rootBegin time.Time, offsetNS int64) *stack_model.StackEntry

Types

type Entry

type Entry struct {
	ID       int
	ParentID int

	FuncInfo *core.FuncInfo

	BeginNs  int64
	EndNs    int64
	Finished bool

	Children []*Entry
	Data     EntryData

	Go bool // has go keyword
	// only valid when Go==true
	GetStack func() *Stack

	FuncName string
	File     string
	Line     int

	HitMock   bool
	Panic     bool
	PanicLine int
	Error     string

	Args    interface{}
	Results interface{}
}

func (*Entry) GetData

func (s *Entry) GetData(key interface{}) interface{}

func (*Entry) SetData

func (s *Entry) SetData(key, value interface{})

type EntryData

type EntryData map[interface{}]interface{}

type Field

type Field struct {
	Name  string
	Value interface{}
}

type G

type G uintptr

G points to runtime.G

func GetG

func GetG() G

func (G) AttachStack

func (g G) AttachStack(stack *Stack)

func (G) DetachStack

func (g G) DetachStack()

func (G) GetOrAttachStack

func (g G) GetOrAttachStack() *Stack

func (G) GetStack

func (g G) GetStack() *Stack

type Stack

type Stack struct {
	Begin      time.Time
	End        time.Time
	MaxEntryID int

	Roots []*Entry
	Top   *Entry
	Depth int

	Data map[interface{}]interface{}
}

func Get

func Get() *Stack

func GetOrAttach

func GetOrAttach() *Stack

func (*Stack) GetData

func (c *Stack) GetData(key interface{}) interface{}

func (*Stack) NewEntry

func (c *Stack) NewEntry(begin time.Time, fnName string) *Entry

func (*Stack) Push

func (c *Stack) Push(cur *Entry) *Entry

push returns the old top

func (*Stack) SetData

func (c *Stack) SetData(key, value interface{})

type StackArgs

type StackArgs []interface{}

Jump to

Keyboard shortcuts

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