Documentation ¶
Overview ¶
mapping to structs in `runtime` package
Link to unexported runtime.nanotime() copy from https://github.com/gavv/monotime/blob/master/monotime.go
Index ¶
- Constants
- type G
- func (c *G) Addr() uint64
- func (c *G) BinStrt() *gbin.Strt
- func (g *G) Dead() bool
- func (g *G) GetLocation(pcType string) *gbin.Location
- func (g *G) GetWaitReason() (string, error)
- func (g *G) GetWaitingChan() (string, error)
- func (g *G) Idle() bool
- func (c *G) Init(p *Process, binStrt *gbin.Strt, addr uint64)
- func (g *G) Parse(addr uint64) error
- func (g *G) ParsePtrSlice(addr uint64) ([]*G, error)
- func (c *G) Process() *Process
- func (g *G) Running() bool
- func (g *G) StackSize() uint64
- func (g *G) Summary(pcType string) (*GSummary, error)
- func (g *G) Syscall() bool
- func (g *G) ThreadID() uint64
- func (g *G) Waiting() bool
- type GSummary
- type GoStructer
- type Gobuf
- type HChan
- type M
- type MCache
- type MCentral
- type MHeap
- type MSpan
- type MemStat
- type P
- func (c *P) Addr() uint64
- func (c *P) BinStrt() *gbin.Strt
- func (p *P) Dead() bool
- func (p *P) Gcstop() bool
- func (p *P) Idle() bool
- func (c *P) Init(p *Process, binStrt *gbin.Strt, addr uint64)
- func (p *P) Parse(addr uint64) error
- func (p *P) ParsePtrSlice(addr uint64) ([]*P, error)
- func (c *P) Process() *Process
- func (p *P) Running() bool
- func (p *P) Syscall() bool
- type PSummary
- type Process
- func (p *Process) Attach() error
- func (p *Process) Detach() error
- func (p *Process) DumpHeap(lock bool) error
- func (p *Process) DumpHeapObjs(lock bool) error
- func (p *Process) DumpVar(name string, lock bool) error
- func (p *Process) GetGs(lock bool) ([]*G, error)
- func (p *Process) GetPs(lock bool) ([]*P, error)
- func (p *Process) GetThread(id int) (t *Thread, ok bool)
- func (p *Process) GoVersion() (string, error)
- func (p *Process) Gomaxprocs() (int, error)
- func (p *Process) MemStat() (*MemStat, error)
- func (p *Process) ReadData(data []byte, addr uint64) error
- func (p *Process) ReadVMA(addr uint64) (uint64, error)
- func (p *Process) RuntimeInitTime() (int64, error)
- func (p *Process) SchedInfo() (*Sched, error)
- func (p *Process) Summary(lock bool) (*PSummary, error)
- type Sched
- type Sudog
- type Thread
- type Type
Constants ¶
const (
HEAP_BASE = 0xC000000000 // go runtime allocate heap starts at 0x00c000000000, ignore ASLR https://github.com/golang/go/issues/27583
)
const POINTER_SIZE = 8
amd64 pointer size
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type G ¶
type G struct { Stack stack `name:"stack" binStrt:"runtime.stack"` ID uint64 `name:"goid"` // goid Status gstatus `name:"atomicstatus"` // atomicstatus WaitReason gwaitReason `name:"waitreason"` // if Status ==Gwaiting Sched Gobuf `name:"sched" binStrt:"runtime.gobuf"` Startpc uint64 `name:"startpc"` Gopc uint64 `name:"gopc"` M *M `name:"m" binStrt:"runtime.m"` // hold worker thread info WaitingSudog *Sudog `name:"waiting" binStrt:"runtime.sudog"` CurLoc *gbin.Location // runtime location UserLoc *gbin.Location // location of user code, a subset of CurLoc GoLoc *gbin.Location // location of `go` statement that spawed this goroutine StartLoc *gbin.Location // location of goroutine start function // contains filtered or unexported fields }
G is runtime.g struct parsed from process memory and binary dwarf
func (*G) GetWaitReason ¶
func (*G) GetWaitingChan ¶
type GoStructer ¶
type Gobuf ¶
type HChan ¶
type HChan struct { QCount uint `name:"qcount"` DataqSize uint `name:"dataqsiz"` ElemSize uint16 `name:"elemsize"` ElemType *Type `name:"elemtype" binStrt:"internal/abi.Type"` Closed uint32 `name:"closed"` Sendx uint `name:"sendx"` Recvx uint `name:"recvx"` // contains filtered or unexported fields }
HChan is runtime.hchan, result of make(chan xx)
type M ¶
type M struct { ID uint64 `name:"id"` ProcID uint64 `name:"procid"` // contains filtered or unexported fields }
M is runtime.m struct
type MCache ¶
type MCache struct { TinyOffset uint64 `name:"tinyoffset"` NTinyallocs uint64 `name:"local_tinyallocs"` Alloc [numSpanClasses]*MSpan `name:"alloc" binStrt:"runtime.mspan"` LargeFree uint64 `name:"local_largefree"` // bytes freed for large objects (>maxsmallsize) NLargeFree uint64 `name:"local_nlargefree"` // number of frees for large objects (>maxsmallsize) FlushGen uint32 `name:"flushGen"` // added on 1.12 // contains filtered or unexported fields }
func (*MCache) SmallSizeObjectSummary ¶
func (c *MCache) SmallSizeObjectSummary() []smallsize
type MCentral ¶
type MCentral struct { SpanClass spanClass `name:"spanclass"` NMalloc uint64 `name:"nmalloc"` // contains filtered or unexported fields }
type MHeap ¶
type MHeap struct { Sweepgen uint32 `name:"sweepgen"` // used to compare with mspan.sweepgen SweepDone uint32 `name:"sweepdone"` //all spans are swept Sweepers uint32 `name:"sweepers"` // number of active sweepone calls MSpans []*MSpan `name:"allspans" binStrt:"runtime.mspan"` PagesInUse uint64 `name:"pagesInUse"` // pages of spans in stats mSpanInUse PagesSwept uint64 `name:"pagesSwept"` // pages swept this cycle LargeAlloc uint64 `name:"largealloc"` // bytes allocated for large objects NLargeAlloc uint64 `name:"nlargealloc"` // number of large object allocations Largefree uint64 `name:"largefree"` // bytes freed for large objects (>maxsmallsize) NLargefree uint64 `name:"nlargefree"` // number of frees for large objects (>maxsmallsize) Central []*MCentral // contains filtered or unexported fields }
MHeap hold process heap info (runtime/mheap.go:mheap)
type MSpan ¶
type MSpan struct { StartAddr uint64 `name:"startAddr"` Npages uint64 `name:"npages"` SpanClass spanClass `name:"spanclass"` Sweepgen uint32 `name:"sweepgen"` AllocCount uint16 `name:"allocCount"` ElemSize uint8 `name:"elemsize"` State mspanstate `name:"state"` // contains filtered or unexported fields }
type MemStat ¶
type MemStat struct { HeapInuse uint64 `name:"heap_inuse"` // bytes allocated and not yet freed HeapObjects uint64 `name:"heap_objects"` // total number of allocated objects HeapSys uint64 `name:"heap_sys"` // virtual address space obtained from system for GC'd heap HeapLive uint64 `name:"heap_live"` // HeapAlloc - (objects not sweeped) Nmalloc uint64 `name:"nmalloc"` // number of mallocs Nfree uint64 `name:"nfree"` // number of frees // gc related PauseTotalNs uint64 `name:"pause_total_ns"` NumGC uint32 `name:"numgc"` NumForcedGC uint32 `name:"numforcedgc"` // number of user-forced GCs LastGC uint64 `name:"last_gc_unix"` // last gc (in unix time) GCCPUFraction float64 `name:"gc_cpu_fraction"` // fraction of CPU time used by GC // contains filtered or unexported fields }
MemStat hold memory usage and gc info (runtime/mstat.go)
type P ¶
type P struct { ID int32 `name:"id"` Status pstatus `name:"status"` Schedtick uint32 `name:"schedtick"` Syscalltick uint32 `name:"syscalltick"` M *M `name:"m" binStrt:"runtime.m"` MCache *MCache `name:"mcache" binStrt:"runtime.mcache"` Runq []byte `name:"runq"` Runqsize int // contains filtered or unexported fields }
P (processor) is runtime.p struct
type PSummary ¶
type PSummary struct { BinPath string RuntimeInitTime int64 Gs []*G Ps []*P Sched *Sched MemStat *MemStat ThreadsTotal int ThreadsSleeping int ThreadsStopped int ThreadsRunning int ThreadsZombie int GTotal int GIdle int GRunning int GSyscall int GWaiting int GoVersion string Gomaxprocs int }
PSummary holds process summary info
func (*PSummary) TotalPauseTime ¶
type Process ¶
type Process struct { ID int // contains filtered or unexported fields }
Process wrap operations on target process
func (*Process) DumpHeapObjs ¶
func (*Process) Gomaxprocs ¶
func (*Process) RuntimeInitTime ¶
type Sched ¶
type Sched struct { Nmidle int32 `name:"nmidle"` // number of idle m's waiting for work Nmspinning uint32 `name:"nmspinning"` Nmfreed uint64 `name:"nmfreed"` // cumulative number of freed m's Npidle int32 `name:"npidle"` // number of idle p's Ngsys uint32 `name:"ngsys"` // number of system goroutines Runqsize int32 `name:"runqsize"` // global runnable queue size // contains filtered or unexported fields }
Sched is the global goroutine scheduler
type Sudog ¶
type Sudog struct { IsSelect bool `name:"isSelect"` Ticket uint32 `name:"ticket"` AcquireTime int64 `name:"acquiretime"` ReleaseTime int64 `name:"releasetime"` C *HChan `name:"c" binStrt:"runtime.hchan"` // contains filtered or unexported fields }
Sudog is runtime.sudog, when a g entering waiting state, it's attached on sudog
type Thread ¶
type Thread struct { ID int // contains filtered or unexported fields }
Thread wrap operations on a system thread