TDSQL Boundless BTHREAD_LIST

BTHREAD_LIST视图用于展示当前系统中 bthread 协程的运行状态。列出当前所有活跃的 bthread,便于排查性能、阻塞、资源占用等问题。

相关产品
TDSQL Boundless 产品页,含版本规格、价格与购买入口。

一、字段说明

字段名 类型 描述
bthread_id bigint unsigned bthread 的唯一标识符。
stop smallint unsigned 标识 bthread 当前是否停止运行(0-运行中,1-已停止)。
interrupted smallint unsigned 表示其他线程是否调用了 bthread_interrupt 中断当前 bthread(0-未中断,1-已中断)。
about_to_quit smallint unsigned 表示当前 bthread 的调度能否推迟执行(0-不可推迟,1-可推迟)。
yield_count smallint unsigned 代表 bthread 让出(yield)计数器,用于决定当 bthread 主动让出 CPU 时,应该将它放入哪个队列。
fn varchar(32) bthread 调用入口函数的指针。
arg varchar(32) bthread 调用入口函数的参数的指针。
attr_stack_type bigint unsigned 栈类型,取值0-4,对应 bthread_stacktype_t 的值。
attr_flags bigint unsigned 位标志,对应 bthread_attrflags_t。
attr_keytable_pool varchar(32) 指向 keytable 的指针。
has_tls smallint unsigned 表示 bthread 是否有 TLS(线程本地存储)(0-无,1-有)。
uptime_ns bigint bthread 从创建到现在的总运行时长(纳秒)。
cputime_ns bigint bthread 实际占用 CPU 的执行时长(纳秒)。
nswitch bigint 上下文切换次数。

二、示例

tdsql > SELECT * FROM information_schema.bthread_list limit 1 \\G*************************** 1. row *************************** bthread_id: 4294980352 stop: 0 interrupted: 0 about_to_quit: 0 yield_count: 0 fn: 0x556eb9fd33a0 arg: 0x7fbc1ab9cd40 attr_stack_type: 3 attr_flags: 0attr_keytable_pool: NULL has_tls: 1 uptime_ns: 71092709249214 cputime_ns: 1273570 nswitch: 31 row in set (0.00 sec)

赞 (0)
上一篇 4天前
下一篇 4天前