xruntime

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: GPL-2.0, GPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

---------------------------------------------------------------------//

GNU GENERAL PUBLIC LICENSE                       //
   Version 2, June 1991                          //
                                                 //

Copyright (C) Wells Hsu, wellshsu@outlook.com, All rights reserved. // Everyone is permitted to copy and distribute verbatim copies // of this license document, but changing it is not allowed. //

SEE LICENSE.md FOR MORE DETAILS.                   //

---------------------------------------------------------------------// Package xruntime: 获取运行时元信息,如协程ID等.

---------------------------------------------------------------------//

GNU GENERAL PUBLIC LICENSE                       //
   Version 2, June 1991                          //
                                                 //

Copyright (C) Wells Hsu, wellshsu@outlook.com, All rights reserved. // Everyone is permitted to copy and distribute verbatim copies // of this license document, but changing it is not allowed. //

SEE LICENSE.md FOR MORE DETAILS.                   //

---------------------------------------------------------------------//

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoID

func GoID(bystack ...bool) int64

获取当前的GoroutineID

notice: 应当尽早使用Context替换GOID逻辑

共有三个版本获取GOID(性能比为: 90:3:1)

1.stack: 通过堆栈信息获取
2.go-tls: go 1.17.*版本无法使用go-tls,参考https://github.com/huandu/go-tls,[20211125待修复]
3.getg: 通过汇编代码获取g结构体,再确定goid的offset,用offset获取goid,参考https://github.com/v2pro/plz

Types

This section is empty.

Jump to

Keyboard shortcuts

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