MySQL-查询线程信息


1. 系统命令

pid: 进程ID。
lwp: 线程ID。在用户态的命令(比如ps)中常用的显示方式。
tid: 线程ID,等于lwp。tid在系统提供的接口函数中更常用,比如syscall(SYS_gettid)和syscall(__NR_gettid)。
tgid: 线程组ID,也就是线程组leader的进程ID,等于pid。
pgid: 进程组ID,也就是进程组leader的进程ID。
pthread id: pthread库提供的ID,生效范围不在系统级别,可以忽略。
sid: session ID for the session leader。
tpgid: tty process group ID for the process group leader。


1)PS 命令查看

ps -eLlf|head -1;ps -eLlf|grep mysql
ps –Lf $pid

image

2)top

top -Hp $pid


3) pidstat

pidstat  -t -p 16370
image


2. MySQL查看

select THREAD_ID,PROCESSLIST_ID,THREAD_OS_ID,name,TYPE from performance_schema.threads;


SELECT a.THREAD_ID,
 a.NAME,
 a.TYPE,
 a.PROCESSLIST_ID,
 a.PROCESSLIST_USER,
 a.PROCESSLIST_HOST,
 a.PROCESSLIST_DB,
 a.PROCESSLIST_COMMAND,
 a.PROCESSLIST_TIME,
 a.CONNECTION_TYPE,
 a.THREAD_OS_ID
 FROM performance_schema.threads a;


image

原文地址:https://www.cnblogs.com/binliubiao/p/12589059.html