Documentation ¶
Overview ¶
Package gdebug 包含一些工具,可以让程序在运行时自我调试。
Index ¶
- func BinVersion() string
- func BinVersionMd5() string
- func Caller(skip ...int) (function string, path string, line int)
- func CallerDirectory() string
- func CallerFileLine() string
- func CallerFileLineShort() string
- func CallerFilePath() string
- func CallerFunction() string
- func CallerPackage() string
- func CallerWithFilter(filters []string, skip ...int) (function string, path string, line int)
- func FuncName(f interface{}) string
- func FuncPath(f interface{}) string
- func GoroutineId() int
- func PrintStack(skip ...int)
- func Stack(skip ...int) string
- func StackWithFilter(filters []string, skip ...int) string
- func StackWithFilters(filters []string, skip ...int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinVersion ¶
func BinVersion() string
BinVersion 返回当前运行二进制文件的版本。 它采用 ghash.BKDRHash+BASE36 算法来计算二进制文件的唯一版本。
func BinVersionMd5 ¶
func BinVersionMd5() string
BinVersionMd5 返回当前运行二进制文件的版本。 它使用MD5算法来计算该二进制文件的唯一版本。
func GoroutineId ¶
func GoroutineId() int
GoroutineId 从堆栈信息中获取并返回当前 goroutine 的 ID。 需要注意的是,由于它使用了 runtime.Stack 函数,所以性能较低。 该函数通常用于调试目的。
func StackWithFilter ¶
StackWithFilter 返回调用该函数的goroutine格式化后的堆栈跟踪。 它通过传入足够大的缓冲区来调用runtime.Stack,以便捕获整个跟踪信息。
参数`filter`用于过滤调用者路径。
func StackWithFilters ¶
StackWithFilters 返回调用该函数的goroutine格式化后的堆栈跟踪。 它通过传递足够大的缓冲区调用runtime.Stack,以捕获整个跟踪信息。
参数`filters`是一个字符串切片,用于过滤调用者路径。
TODO 使用debug.Stack改进性能。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.