runtimex

package
v0.0.0-...-052ef2a Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 9 Imported by: 0

README

Get id of a goroutine

Go Report Card Build Status

Feature

  • easy to use
  • tiny size

Usage

id := gid.Get()

Support

  • go 1.5
  • go 1.6
  • go 1.7
  • go 1.8
  • go 1.9
  • go 1.10
  • go 1.11
  • go 1.12
  • go 1.13
  • go 1.14
  • go 1.15
  • go 1.16
  • go 1.17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fastrand

func Fastrand() uint32

func FuncFromPointer

func FuncFromPointer(p unsafe.Pointer) func()

func FuncToPC

func FuncToPC(fn func()) uintptr

func FuncToPCUnsafe

func FuncToPCUnsafe(p unsafe.Pointer) uintptr

func FuncToPointer

func FuncToPointer(fn func()) unsafe.Pointer

func GIDPID

func GIDPID() (gid uint64, pid int32)

func GoroutineID

func GoroutineID() uint64

func MachineID

func MachineID() int64

func Pid

func Pid() (id int)

Pid returns the id of current p.

func Pin

func Pin() int

Pin pins current p, return pid. DO NOT USE if you don't know what this is.

func ProcID

func ProcID() uint64

func ProcessorID

func ProcessorID() int32

func ReadUnaligned16

func ReadUnaligned16(p unsafe.Pointer) uint64

func ReadUnaligned32

func ReadUnaligned32(p unsafe.Pointer) uint64

func ReadUnaligned64

func ReadUnaligned64(p unsafe.Pointer) uint64

func RuntimeFuncOf

func RuntimeFuncOf(fn func()) *runtime.Func

func Systemstack

func Systemstack(fn func())

func Unpin

func Unpin()

Unpin unpins current p.

func VisitCallerArgs

func VisitCallerArgs(args *VisitArgs, fn func(visitArgs *VisitArgs))

Types

type FuncInfo

type FuncInfo[T any] struct {
	// contains filtered or unexported fields
}

func GetFuncInfo

func GetFuncInfo(fn func()) *FuncInfo[any]

func GetFuncInfoUnsafe

func GetFuncInfoUnsafe(pc uintptr) *FuncInfo[any]

func GetMethod

func GetMethod(pc uintptr) *FuncInfo[any]

func GetMethodSlow

func GetMethodSlow(
	object interface{},
	methodWrapperPC uintptr,
	methodName string,
) *FuncInfo[any]

func GetRunnable

func GetRunnable(runnable Runnable) *FuncInfo[any]

func VisitCaller

func VisitCaller(fn func(*FuncInfo[any])) *FuncInfo[any]

func (*FuncInfo[T]) Data

func (f *FuncInfo[T]) Data() T

func (*FuncInfo[T]) Entry

func (f *FuncInfo[T]) Entry() uintptr

func (*FuncInfo[T]) File

func (f *FuncInfo[T]) File() string

func (*FuncInfo[T]) Formatted

func (f *FuncInfo[T]) Formatted() string

func (*FuncInfo[T]) Line

func (f *FuncInfo[T]) Line() int

func (*FuncInfo[T]) Method

func (f *FuncInfo[T]) Method() reflect.Method

func (*FuncInfo[T]) MethodName

func (f *FuncInfo[T]) MethodName() string

func (*FuncInfo[T]) Name

func (f *FuncInfo[T]) Name() string

func (*FuncInfo[T]) NumIn

func (f *FuncInfo[T]) NumIn() int

func (*FuncInfo[T]) NumOut

func (f *FuncInfo[T]) NumOut() int

func (*FuncInfo[T]) PC

func (f *FuncInfo[T]) PC() uintptr

func (*FuncInfo[T]) Receiver

func (f *FuncInfo[T]) Receiver() string

func (*FuncInfo[T]) ReceiverSize

func (f *FuncInfo[T]) ReceiverSize() uintptr

func (*FuncInfo[T]) SetData

func (f *FuncInfo[T]) SetData(data T)

func (*FuncInfo[T]) String

func (f *FuncInfo[T]) String() string

type FuncInfoMap

type FuncInfoMap[T any] struct {
	// contains filtered or unexported fields
}

func NewFuncInfoMap

func NewFuncInfoMap[T any]() *FuncInfoMap[T]

func (*FuncInfoMap[T]) Get

func (fip *FuncInfoMap[T]) Get(fn func()) *FuncInfo[T]

func (*FuncInfoMap[T]) GetMethod

func (fip *FuncInfoMap[T]) GetMethod(methodWrapperPC uintptr) *FuncInfo[T]

func (*FuncInfoMap[T]) GetMethodSlow

func (fip *FuncInfoMap[T]) GetMethodSlow(
	object interface{},
	methodWrapperPC uintptr,
	methodName string,
) *FuncInfo[T]

func (*FuncInfoMap[T]) GetPC

func (fip *FuncInfoMap[T]) GetPC(pc uintptr) *FuncInfo[T]

func (*FuncInfoMap[T]) GetSlow

func (fip *FuncInfoMap[T]) GetSlow(pc uintptr) *FuncInfo[T]

type Runnable

type Runnable interface {
	Run()
}

type VisitArgs

type VisitArgs struct {
	Args uintptr
	Func *FuncInfo[any]
}

Jump to

Keyboard shortcuts

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