Sysproc 探针管理器
sysproc 探针管理器提供一个基础结构,用户和管理员可使用此基础结构动态跟踪进程或线程相关数据而不必知道 sysproc 子系统的内部信息。
用户或管理员的
sysproc 子系统的各个方面分为以下主要类别:
- 进程(或线程)创建或终止
- 信号生成和传送
- 调度程序和分派器事件
- DR 和 CPU 绑定事件
进程(或线程)创建或终止
- 进程是自然退出还是因为错误退出?
- 进程或线程是在什么时候创建、终止或超过限制的?
- 进程运行了多少时间?
- 线程接收到异常或从异常返回时跟踪事件。
信号生成和传送
- 特定目标的信号源和信号信息。
- 异步信号的信号传送。
- 跟踪信号清除。
- 安装非缺省信号处理程序时跟踪事件。
- 特定源的信号目标和信号信息。
- 跟踪信号处理程序进入或退出。
调度程序和分派器事件
调度程序和分派器指示进程或线程如何在系统中运行。 管理员通过使用动态跟踪调度程序或分派器子系统分析系统性能。
动态跟踪调度程序或分派器子系统帮助发现保留线程的原因。
- 跟踪加入或退出运行队列的线程。
- 系统中的任何线程被抢占时跟踪事件。
- 发生事件时线程被置于休眠状态的情况下进行跟踪。
- 休眠线程被唤醒时进行跟踪。
- 跟踪线程的分派等待时间。
- 跟踪虚拟处理器折叠事件。
- 任何内核线程优先级更改时进行跟踪。
动态重新配置 (DR) 和 CPU 绑定事件
此类探针为跟踪绑定至进程的资源的用户提供动态跟踪功能。
- 线程绑定从一个 CPU 切换至另一个 CPU 时进行跟踪。
- 资源附加至进程或从进程拆离时进行跟踪。
- 跟踪 CPU 绑定事件。
- 跟踪 DR 事件的开始或结束。
调查规范
必须在 Vue 脚本中使用以下格式以探测 sysproc 事件:
@@sysproc:<sysproc_event>:<pid/tid/*>
第一元组
@@sysproc 指示此探针特定于 sysproc 事件。
第二元组指定要探测的事件。
信号发送事件(在此事件中,进程发送此信号或接收此信号)可能很有用。 以下信息对这类探测事件指定相应的过滤器。
调查点 (相关事件)
下表中提及了可通过 sysproc 探针管理器探测的所有事件的简短描述:
| 探针 (sysproc_event) | 描述 |
|---|---|
| forkfail | 跟踪派生接口中的故障。 |
| execfail | 跟踪执行接口中的故障。 |
| execpass | 跟踪执行成功。 |
| exit | 跟踪进程出口。 |
| threadcreate | 跟踪内核线程的创建。 |
| threadterminate | 跟踪内核线程的终止。 |
| threadexcept | 跟踪进程异常。 |
| sendsig | 跟踪外部源向进程发送的信号。 |
| sigqueue | 跟踪排队发送至进程的信号 |
| sigdispose | 跟踪信号处置。 |
| sigaction | 跟踪信号处理程序安装和重新安装 |
| sighandlestart | 调用信号处理程序时进行跟踪。 |
| sighandlefinish | 信号处理程序完成时进行跟踪 |
| changepriority | 进程优先级更改时进行跟踪 |
| onreadyq | 内核线程加入就绪队列时进行跟踪。 |
| offreadyq | 内核线程离开就绪队列时进行跟踪。 |
| 分派 (dispatch) | 调用系统分派器来调度线程时进行跟踪 |
| oncpu | 内核线程获取 CPU 时进行跟踪。 |
| offcpu | 内核线程释放 CPU 时进行跟踪。 |
| blockthread | 线程被阻止获取 CPU 时进行跟踪。 |
| foldcpu | 跟踪 CPU 核心的折叠。 |
| bindprocessor | 进程/线程绑定至 CPU 时跟踪事件 |
| changecpu | 内核线程临时切换 CPU 时跟踪事件 |
| resourceattach | 一个资源附加至另一个资源时跟踪事件 |
| resourcedetach | 一个资源与另一个资源拆离时跟踪事件 |
| drphasestart | drphase 启动时进行跟踪 |
| drphasefinish | drphase 完成时进行跟踪 |
在探针点访问数据的方法
ProbeVue 允许通过内置变量进行数据访问。
- 可在任何探针点访问,而不理会探针管理器。 例如:
__curthread。 - 可在特定探针管理器的所有探针中访问。
- 只能在所定义探针中访问(相关的事件)
类型为 (1) 的内置值列表如下所示。
- __trcid
- __errno__kernelmode
- __arg1 到 __arg7
- __curthread
- __curproc
- __mst
- __tid
- __pid
- __ppid
- __pgid
- __uid
- __euid
- __ublock
- __execname
- __pname
这些内置变量也分类为特定于上下文的变量和与上下文无关的变量。 特定于上下文的内置项根据探针的执行上下文来提供数据。
AIX® 内核在线程或中断上下文中运行。 特定于上下文的探针在线程或进程上下文中启动时,这些探针产生正确结果。
在中断执行上下文中,通过特定于上下文的内置项获取的结果可能是意外结果。 与上下文无关的内置项不依赖于执行上下文,并且可在不理会探针执行环境的情况下放心地访问。
| 特定于上下文的内置变量 | 独立于上下文的内置变量 |
|---|---|
| __curthread | __trcid |
| __curproc | __errno |
| __tid | __kernelmode |
| __pid | __arg1 到 __arg7 |
| __ppid | __mst |
| __pgid | |
| __uid | |
| __euid | |
| __ublock | |
| __pname | |
| __execname |
探测点
探针点是触发探针的特定事件。 以下是探针点列表。
- forkfail
派生失败时,
forkfail探针启动。 此探针确定派生失败的原因。语法:
@@sysproc:forkfail:<pid/tid/*>受支持的特殊内置项
__forkfailinfo { fail_reason; }fail_reason变量具有下列其中一个值:表 3。 fail_reason 探测器: 失败原因 原因 描述 FAILED_RLIMIT 因为 rlimit 限制而失败 FAILED_ALLOCATIONS 因为内部资源分配失败 FAILED_LOADER 在装入器阶段失败 FAILED_PROCDUP 在 procdup 处失败 其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid,__ublock,__execname,__pname.执行环境
在进程环境中运行。
示例
以下示例显示如何监视系统中因为 rlimit 而导致的所有派生故障。
@@BEGIN { x = 0; } @@sysproc:forkfail:* when (__forkfailinfo->fail_reason == FAILED_RLIMIT) { printf ("process %s with pid %llu failed to fork a child\n",__pname,__pid); x++; } @@END { printf ("Found %d failures during this vue session\n",x); }- execfail
exec函数调用失败时,execfail探针启动。 使用execfail探针确定失败原因。语法:
@@sysproc:execfail:<pid/tid/*>表 4。 execfail 探测器: 失败原因 原因 描述 FAILED_PRIVILEGES 新进程未能获取或继承特权 FAILED_COPYINSTR 新进程未能复制指令 FAILED_V_USERACC 新进程未能废弃 v_useracc 区域 FAILED_CLEARDATA 清除新进程的数据期间失败 FAILED_PROCSEG 未能建立进程私有分段 FAILED_CH64 未能转换为 64 位进程 FAILED_MEMATT 未能附加至内存资源集 FAILED_SRAD 未能附加至 srad FAILED_MSGBUF 错误消息:缓冲区长度为零 FAILED_ERRBUF 未能分配错误消息缓冲区 FAILED_ENVAR 未能分配环境变量 FAILED_CPYSTR 复制字符串错误 FAILED_ERRBUFCPY 未能从 errmsg_buf 复制错误消息 FAILED_TOOLNGENV 环境太长,无法装入到已分配内存中 FAILED_USRSTK 未能设置用户堆栈 FAILED_CPYARG 未能将 arglist 复制到堆栈 FAILED_INITPTRACE 未能启动 ptrace 注: 如果迂到装入程序错误,那么会将 64 添加到错误值。其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid,__ublock,__execname,__pname.执行环境
在进程环境中运行。
- exit
进程退出时,此探针启动。 出口也是一个系统调用管理器,通过系统调用探针管理器进行跟踪。 通过
sysproc探针管理器探测出口系统调用说明出口的性质和原因。 它还说明用户线程在内核空间中终止并且不返回至用户空间的原因。语法:
@@sysproc:forkfail:<pid/tid/*>程序可因为以下原因退出:
- 达到终止条件时,此时用户空间程序无法再继续。
- 接收到终止信号时。
受支持的特殊内置项
__exitinfo{ signo; returnval; iscore; }其中,signo 值指示导致进程终止的信号编号,returnval 是出口返回的值。 仅当程序通过信号停止时,非零 signo 才有效。
因为进程退出而生成核心时,将设置
iscore变量。其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid,__ublock,__execname,__pname.执行环境
在进程环境中运行。
示例
以下示例说明如何探测
exit事件echo '@@sysproc:exit:* { printf (" %s %llu %llu\n", __pname, __pid,__exitinfo->returnval);}' | probevueWhich will produce an output similar to the following. ksh 5833042 0 telnetd 7405958 1 dumpctrl 7405960 0 setmaps 7275006 0 termdef 7274752 0 hostname 7274754 0 id 8257976 0 id 8257978 0 uname 8257980 0 expr 8257982 1- threadcreate
成功创建线程时,
threadcreate探针启动。语法:
@@sysproc:threadcreate:<pid/tid/*>注: 指定的pid或tid必须是创建线程的进程或线程的进程标识。受支持的特殊内置项
__threadcreateinfo { tid; pri; policy; }其中
tid指示所创建新线程的线程标识,priority 是线程的优先级。 policy 指示线程的线程调度策略。表 5。 threadcreate 探针的策略值 策略 描述 SCHED_OTHER 缺省 AIX 调度策略 SCHED_FIFO 先进先出调度策略 SCHED_RR 循环法调度策略 SCHED_LOCAL 局部线程范围调度策略 SCHED_GLOBAL 全局线程范围调度策略 SCHED_FIFO2 短暂休眠后进行 FIFO 和 RQHEAD SCHED_FIFO3 一直进行 FIFO 和 RQHEAD SCHED_FIFO4 FIFO 和弱抢占 其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid,__ublock,__execname,__pname.执行环境
在进程环境(用户或 kproc)中运行。
示例
用于在创建一个线程的系统中持续显示所有进程,该线程显示进程名称并创建进程标识(新创建的线程的标识和创建时间戳记)。
echo '@@sysproc:threadcreate:* { printf ("%s %llu %llu %A\n",__pname,__pid,__threadcreateinfo->tid,timestamp());}' | probevue将显示类似以下示例的输出。
nfssync_kproc 5439964 23921151 Feb/22/15 09:22:38 nfssync_kproc 5439964 24052201 Feb/22/15 09:22:38 nfssync_kproc 5439964 23920897 Feb/22/15 09:22:38 nfssync_kproc 5439964 22479285 Feb/22/15 09:22:55 nfssync_kproc 5439964 23920899 Feb/22/15 09:22:55 nfssync_kproc 5439964 22479287 Feb/22/15 09:22:55- threadterminate
该探针针对已终止的线程启动。
语法:
@@sysproc:threadterminate:<pid/tid/*>注: 指定的进程标识或线程标识必须与当前正在停止的进程或线程相对应。受支持的特殊内置项
无。
其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程环境(用户或 kproc)中运行。
示例
用于在终止一个线程的系统中持续显示所有进程,该线程显示进程名称并创建进程标识(新创建的线程的标识和创建时间戳记)。
将显示类似于以下样本的输出:# echo '@@sysproc:threadterminate:* { printf ("%s %llu %llu %A\n",__pname,__pid,__tid,timestamp());}' | probevuenfssync_kproc 5439964 23855555 Feb/22/15 09:59:30 nfssync_kproc 5439964 21758249 Feb/22/15 09:59:30 nfssync_kproc 5439964 23855557 Feb/22/15 09:59:30- threadexcept
发生程序异常时,此探针启动。 系统检测到程序无法正常继续的情况时,生成程序异常。 某些异常是致命的(非法指令),而某些异常是可恢复的(地址空间更改)。
语法:
@@sysproc:threadexcept:<pid/tid/*>受支持的特殊内置项
__threadexceptinfo { pid; tid; exception; excpt_address }其中
pid指示接收到异常的进程的进程标识,tid 是接收到异常的内核的线程标识,excpt_address是导致此异常的地址,而异常可按表中指示采用某个值。表 6。 threadexcept 探针的异常值 异常 描述 EXCEPT_FLOAT 浮点异常 EXCEPT_INV_OP 无效操作码 EXCEPT_PRIV_OP 用户方式的特权操作 EXCEPT_TRAP 陷阱指令 EXCEPT_ALIGN 代码或数据对齐 EXCEPT_INV_ADDR 无效地址 EXCEPT_PROT 保护 EXCEPT_IO 同步 I/O EXCEPT_IO_IOCC 来自 IOCC 的 I/O 异常 EXCEPT_IO_SGA 来自 SGA 的 I/O 异常 EXCEPT_IO_SLA 来自 SLA 的 I/O 异常 EXCEPT_IO_SCU 来自 SCU 的 I/O 异常 EXCEPT_EOF 超出文件末尾的引用 (mmap) EXCEPT_FLOAT_IMPRECISE 非精确浮点异常 EXCEPT_ESTALE_I 旧文本段异常 EXCEPT_ESTALE_D 旧数据段异常 EXCEPT_PT_WATCHP 命中 ptrace 观察点 其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程或中断环境中运行。
注: 由于此探测器可以在中断上下文中启动,因此依赖于执行上下文的内置变量 (例如__pid和__tid) 可能不会指示进程或线程标识。 此探针的特殊内置成员保证对进程或线程使用正确进程或线程标识。示例
以下示例显示调试器跟踪的探测事件生成的跟踪程序异常。
将显示类似于以下样本的输出:# cat threadexcept.e @@sysproc:threadexcept:* { printf ("PID = %llu TID= %llu EXCEPTION=%llu ADDRESS = %llu\n ",__threadexceptinfo->pid,__threadexceptinfo->tid,__threadexceptinfo- >exception,__threadexceptinfo->excpt_address); } Run a debugging session on a program compiled with debugging support # dbx a.out Type 'help' for help. Core file "core" is older than current program (ignored) reading symbolic information ... (dbx) stop in main [1] stop in main (dbx) r [1] stopped in main at line 5 5 int a=5;PID = 6816134 TID= 24052015 EXCEPTION=131 ADDRESS = 268436372- sendsig
通过外部源(其他进程、来自用户空间的进程、来自内核流或中断上下文的进程)向进程发送信号时,此探针启动。
语法:
@@sysproc:sendsig:<pid/*>__dispatchinfo{ cpuid; <- cpu id oldpid; <- pid of the thread currently running oldtid; <- thread id of the thread currently running oldpriority; <- priority of the thread currenly running newpid; <- pid of the new process process selected for running newtid; <- thread id of the thread selected for running newpriority; <-priority of the thread selected for running }其中 pid 是接收此信号的目标进程的进程标识。 此探针不允许指定线程标识来过滤特定于线程的结果。
特殊内置项
_sigsendinfo{ tpid; ← target pid spid; ← source pid signo; ← signal sent }其中,
tpid是目标源进程标识,spid标识信号源。 如果信号是从用户空间或进程上下文发送的,那么spid为非零。 如果信号是从异常或中断上下文发送的,那么源进程标识为 0。 信号编号信息包含在signo中。其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程或中断环境中运行。
注: 由于此探测器可以在中断上下文中启动,因此依赖于线程执行上下文的内置项 (例如__pid,__tid) 可能不会指示相关进程或线程标识。 此探针的特殊内置成员保证对进程或线程使用正确进程或线程标识。此探针在进程上下文中启动时,依赖于执行上下文的内置成员指向源进程。 内置成员 (例如
.__pid,__tid和__curthread) 提供有关源进程的信息。示例
将显示类似于以下样本的输出:To continuously print signal source signal target and signal number of all signals. echo '@@sysproc:sendsig:* {printf ("Source=%llu Target=%llu sig=%llu\n",__sigsendinfo->spid,__sigsendinfo->tpid,__sigsendinfo->signo);}' | probevueSource=0 Target=6619618 sig=14 Source=0 Target=8257944 sig=20 Source=0 Target=8257944 sig=20- sigqueue
向进程发送已加入队列的信号时,此探针启动。
语法:
@@sysproc:sigqueue:<pid/*>特殊内置项
_sigsendinfo{ tpid; ← target pid spid; ← source pid preprocess.cp signo; ← signal sent }因为 posix 信号已加入队列以等待发送至进程,所以不允许在此探针中指定线程标识。
其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.此探针在发送进程的上下文中启动。 因此,基于上下文的内置项是指此探测事件中的发送进程。
执行环境
此探针在进程上下文中运行。
示例
将显示类似于以下样本的输出:echo '@@sysproc:sigqueue:*{printf ("%llu %llu %llu\n",__sigsendinfo->spid,__sigsendinfo->tpid,__sigsendinfo->signo);}' | probevue8258004 6095294 31 sigdispose Syntax : @@sysproc:sigdispose:<pid/tid/*>针对目标进程处置信号时,此探针启动。 在 sysprobe 规范中指定接收到此信号的进程的进程标识以过滤此探针。
特殊内置项
__sigdisposeinfo{ tpid; ← target pid ttid; ← target tid signo; ← signal whose action is being taken. fatal; ← will be set if the process is going to be killed as part of signal action }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
此探针可从进程或中断上下文启动。 如果已从中断上下文启动,那么此探针可能不会提供基于上下文的内置项所需的值。
示例
对于系统中的所有进程,持续显示进程标识、线程标识、信号编号,并指示此信号处置是否导致进程终止。
将显示类似于以下样本的输出:cat sigdispose.e @@sysproc:sigdispose:* { printf ("%llu %llu %llu %llu\n",__sigdisposeinfo->tpid,__sigdisposeinfo->ttid, __sigdisposeinfo->signo,__sigdisposeinfo->fatal); }5964064 20840935 14 0 1 65539 14 0 4719084 19530213 14 0- sigaction
语法:
@@sysproc:sigaction:<pid/tid/*>安装或替换信号处理程序时,此探针启动。
特殊内置项
__sigactioninfo{ old_sighandle; ← old signal handler function address new_sighandle; ←new signal handler function address signo; ← Signal number rpid; ← requester's pid }如果第一次安装信号处理程序,那么
old_sighandle将为 0。其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
此探针在进程环境中启动。
注: AIX 内核确保一次仅向进程或线程传递一个信号。 仅当信号传送完成时,才会向该进程或线程发送另一个信号。示例
要跟踪系统中所有信号的开始和结束:
可以显示类似于以下样本的输出:@@sysproc:sighandlestart:* { signal[__tid] = __sighandlestartinfo->signo; printf ("Signal handler at address 0x%x invoked for thread id %llu to handle signal %llu\n",__sighandlestartinfo- >sighandle,__curthread->tid,__sighandlestartinfo->signo); } @@sysproc:sighandlefinish:* { printf ("Signal handler completed for thread id %llu for signal %llu\n",__curthread->tid,signal[__tid]); delete (signal,__tid); }Signal handler at address 0x20001d58 invoked for thread id 19923365 to handle signal 20 Signal handler completed for thread id 19923365 for signal 20 Signal handler at address 0x10003400 invoked for thread id 20840935 to handle signal 14 Signal handler completed for thread id 20840935 for signal 14 Signal handler at address 0x10002930 invoked for thread id 19530213 to handle signal 14 Signal handler completed for thread id 19530213 for signal 14 Signal handler at address 0x300275d8 invoked for thread id 22348227 to handle signal 14 Signal handler completed for thread id 22348227 for signal 14 Signal handler at address 0x20001a3c invoked for thread id 65539 to handle signal 14 Signal handler completed for thread id 65539 for signal 14- sighandlefinish
此探针在信号处理程序完成时启动。
语法:
@@sysproc:sighandlestart:<pid/tid/*>受支持的特殊内置项:无。
其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程环境中运行。 受保护,不允许在执行 CPU 上进行上下文切换。
- changepriority
进程的优先级更改时,此探针启动。 此事件不是调度程序或分派器强制执行的。
语法:
@@sysproc:changepriority:<pid/tid/*>注: 优先级更改可能也不成功; 不保证优先级更改成功。受支持的特殊内置项
__chpriorityinfo{ pid; old_priority; <- current priority new_priority; <- new scheduling priority of the thread. }执行环境
此探针在进程环境中运行。
其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid,__ublock,__execname,__pname.示例
要跟踪其优先级更改的所有进程:
将显示类似于以下样本的输出:echo '@@sysproc:changepriority:* { printf ("%s priority changing from %llu to %llu\n",__pname,__chpriorityinfo->old_priority,__chpriorityinfo- >new_priority);}' | probevuexmgc priority changing from 60 to 17 xmgc priority changing from 17 to 60 xmgc priority changing from 60 to 17 xmgc priority changing from 17 to 60 xmgc priority changing from 60 to 17- offreadyq
线程离开系统运行队列时,此探针启动。
语法:
@@sysproc:offreadyq:<pid/tid/*>Special built-ins supported __readyprocinfo{ pid; <- process id of thread becoming ready tid; <- Thread id. priority; <- priority of the thread }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程或中断环境中运行。
用例:跟踪执行 I/O 操作的线程返回至就绪队列所消耗的时间。
将显示类似于以下样本的输出:@@BEGIN { printf (" Pid Tid Time Delta\n"); } @@sysproc:offreadyq :* { ready[__tid] = timestamp(); printf ("offreadyq: %llu %llu %W\n",__readyprocinfo->pid,__readyprocinfo->tid,ready[__tid]); } @@sysproc:onreadyq :* { if (diff_time(ready[__tid],0,MICROSECONDS)) { auto:diff = diff_time (ready[__tid],timestamp(),MICROSECONDS); printf ("onreadyq : %llu %llu %W %llu\n",__readyprocinfo->pid,__readyprocinfo->tid,ready[__tid],diff); delete (ready,__tid); } }Pid Tid Time Delta offreadyq: 7799280 20709717 5s 679697µs onreadyq : 7799280 20709717 5s 679697µs 6 offreadyq: 7799280 20709717 5s 908716µs onreadyq : 7799280 20709717 5s 908716µs 3 offreadyq: 7799280 20709717 6s 680186µs onreadyq : 7799280 20709717 6s 680186µs 5 offreadyq: 7799280 20709717 6s 710720µs onreadyq : 7799280 20709717 6s 710720µs 4 offreadyq: 7799280 20709717 6s 800720µs onreadyq : 7799280 20709717 6s 800720µs 2 offreadyq: 7799280 20709717 6s 882231µs onreadyq : 7799280 20709717 6s 882231µs 2 offreadyq: 7799280 20709717 6s 962313µs onreadyq : 7799280 20709717 6s 962313µs 2 offreadyq: 7799280 20709717 6s 980311µs onreadyq : 7799280 20709717 6s 980311µs 2- onreadyq
线程进入系统就绪队列或它在就绪队列中的位置被修改时,此探针启动。
语法:
@@sysproc:offreadyq:<pid/tid/*>受支持的特殊内置项
__readyprocinfo{ pid; <- process id of thread becoming ready tid; <- Thread id. priority; <- priority of the thread }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程或中断环境中运行。
- 分派 (dispatch)
调用系统分派器以选择要在特定 CPU 上运行的线程时,此探针启动。
语法:
@@sysproc:dispatch:<pid/tid/*>受支持的特殊内置项
__dispatchinfo{ cpuid; <- CPU where selected thread will run. oldpid; <- pid of the thread currently running oldtid; <- thread id of the thread currently running oldpriority; <- priority of the thread currenly running newpid; <- pid of the new process process selected for running newtid; <- thread id of the thread selected for running newpriority; <-priority of the thread selected for running }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
仅在中断环境中运行。
示例
将显示类似于以下示例的输出:print process thread id of old and selected thread on CPU '0' with dispatch time relative to start of the script echo '@@sysproc:dispatch:* when (__cpuid == 0){printf ("%llu %llu %W\n",__dispatchinfo->oldtid,__dispatchinfo->newtid,timestamp());}' | probevue24641983 20709717 0s 48126µs 20709717 23593357 0s 48164µs 23593357 20709717 0s 48185µs 20709717 23593357 0s 48214µs 23593357 20709717 0s 48230µs 20709717 23593357 0s 48288µs 23593357 261 0s 48303µs 261 20709717 0s 48399µs Example II Time spent on CPU '0' by threads in between dispatch event. @@BEGIN { printf ("Thread cpu Time-Spent\n"); } @@sysproc:dispatch:* when (__cpuid == $1) { if (savetime[__cpuid] != 0) auto:diff = diff_time (savetime[__cpuid],timestamp(),MICROSECONDS); else diff = 0; savetime[__cpuid] = timestamp(); printf ("%llu %llu %llu\n",__dispatchinfo->oldtid,__dispatchinfo->cpuid,diff); } # probevue cputime.e 6 Thread cpu Time-Spent 3146085 6 0 3146085 6 9995 3146085 6 10002 3146085 6 10008 3146085 6 99988 3146085 6 100006 3146085 6 99995 3146085 6 99989 3146085 6 100010 3146085 6 100001 3146085 6 100000 3146085 6 99998可以观察到,在没有任何其他与此 CPU 竞争的线程的情况下,正在以 1sec 的时间间隔在 CPU 上重新分派线程 3146085。
- oncpu
新进程或线程获取 CPU 时,此探针启动。
语法:
@@sysproc:oncpu:<pid/tid/*>其中
pid是进程标识,tid是获取 CPU 的进程或线程的线程标识。受支持的特殊内置项
__dispatchinfo{ cpuid; <- CPU where selected thread will run. newpid; <- pid of the new process process selected for running newtid; <- thread id of the thread selected for running newpriority; <-priority of the thread selected for running }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
仅在中断环境中运行。
示例
将显示类似于以下示例的输出:To print time spent by threads of sysncd on all CPU's #!/usr/bin/probevue @@BEGIN { printf ("PROCESSID THREADID CPU TIME\n"); } @@sysproc:oncpu:$1 { savetime[__cpuid] = timestamp(); } @@sysproc:offcpu:$1 { if (savetime[__cpuid] != 0) auto:diff = diff_time (savetime[__cpuid],timestamp(),MICROSECONDS); else diff = 0; printf ("%llu %llu %llu %llu\n", __dispatchinfo->oldpid, __dispatchinfo->oldtid, __dispatchinfo->cpuid, diff); } # cputime.e `ps aux|grep syncd| grep -v grep| cut -f 6 -d " "`3735998 18612541 0 2 3735998 15663427 0 1 3735998 15073557 0 1 3735998 18743617 0 1 3735998 18874693 0 1 3735998 18809155 0 15 3735998 18940231 0 20 3735998 18547003 0 1 3735998 19267921 0 1 3735998 19071307 0 17 3735998 18678079 0 1 3735998 18481465 0 1 3735998 19202383 0 15 3735998 19005769 0 1 3735998 19136845 0 19 3735998 6160689 0 190- offcpu
从 CPU 分派进程或线程时,此探针启动。
语法:
@@sysproc:dispatch:<pid/tid/*>受支持的特殊内置项
__dispatchinfo{ cpuid; <- CPU where selected thread will run. newpid; <- pid of the new process process selected for running newtid; <- thread id of the thread selected for running newpriority; <-priority of the thread selected for running }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
仅在中断环境中运行。
blockthread
线程被阻止在 CPU 上运行时,此探针启动。 阻止是休眠的一种形式,此时线程在不包含任何资源的情况下休眠。
语法:
@@sysproc:blockthread:*受支持的特殊内置项
__sleepinfo{ pid; tid; waitchan; <-- wait channel of this sleep. }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
仅在中断环境中运行。
- foldcpu
CPU 核心将折叠时,此探针启动。 此探针不会出现在进程上下文中,并且不能使用 pid 或 tid 进行过滤。
语法:
@@sysproc:foldcpu:*受支持的特殊内置项
__foldcpuinfo{ cpuid; <- logical cpu id which triggers core folding gpcores; <- general purpose (unfolded, non-exclusive) cores available. }其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7.例如:
要跟踪系统中的所有 CPU 折叠事件:
__foldcpuinfo{ cpuid; <- logical cpu id which triggers core folding gpcores; <- general purpose (unfolded, non-exclusive) cores available. }- bindprocessor
语法:
@@sysproc:bindprocessor:<pid/tid/*>线程或进程绑定至 CPU 时,此探针启动。 Bindprocessor 是永久事件,不能与临时 CPU 切换混淆。
受支持的特殊内置项
__bindprocessorinfo{ ispid <- 1 if cpu is bound to process; 0 for a thread id; <- thread or process id. cpuid; };其他受支持的内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程环境中运行。
- changecpu
线程临时切换 CPU 时,此探针启动。 在 CPU 汇集事件或某些
kproc事件意外跳转以执行 CPU 相关任务(xmgc进程跳至所有 CPU 以管理内核堆)特殊内置项期间,此事件可能被捕获。语法:
@@sysproc:changecpu:*>受支持的特殊内置项
__changecpuinfo { oldcpuid; <-source CPU newcpuid; <- target CPU pid; tid; <-Thread id }其他受支持内置项
__errno__kernelmode,__arg1 to __arg7,__curthread,__curproc,__mst,__tid,__pid,__ppid,__pgid,__uid,__euid.执行环境
在进程环境中运行。
示例
将显示类似于以下示例的输出:@@sysproc:changecpu:* { printf ("changecpu PID=%llu TID=%llu old_cpuid=%d new_cpuid= %d \n", __changecpuinfo->pid,__changecpuinfo->tid,__changecpuinfo->oldcpuid,__changecpuinfo->newcpuid); }changecpu PID=852254 TID=1769787 old_cpuid=26 new_cpuid= 27 changecpu PID=852254 TID=1769787 old_cpuid=-1 new_cpuid= 0 changecpu PID=852254 TID=1769787 old_cpuid=0 new_cpuid= 1 changecpu PID=852254 TID=1769787 old_cpuid=1 new_cpuid= 2- resourceattach
系统中的一个资源附加至另一个资源时,将触发此探针。
语法:
@@sysproc:resourceattach:*>受支持的特殊内置项
__srcresourceinfo{ type; subtype; id; <- resource type identifier offset; <-offset if a memory resource length; <- length if a memory resource policy; } __tgtresourceinfo{ type; subtype; id; <- resource type identifier offset; <-offset if a memory resource length; <- length if a memory resource policy; }其中 type 和 subtype 可为下列其中一个值。表 7。 resourceattach 探针:type 和 subtype 值 资源类型 描述 R_NADA 无 - 无效指定 R_PROCESS 处理 R_RSET 资源集 R_SUBRANGE 内存范围 R_SHM 共享内存 R_FILDES 已打开文件所标识的文件 R_THREAD 线程 R_SRADID SRAD 标识 R_PROCMEM 进程内存 其他受支持内置项
__errno__kernelmode,__arg1 to __arg7,__mst.执行环境
在进程环境中运行。
- resourcedetach
系统中的一个资源与另一个资源拆离时,将触发此探针。
语法:
@@sysproc:resourcedetach:*>受支持的特殊内置项
__srcresourceinfo{ type; subtype; id; <- resource type identifier offset; <-offset if a memory resource length; <- length if a memory resource policy; } __tgtresourceinfo{ type; subtype; id; <- resource type identifier offset; <-offset if a memory resource length; <- length if a memory resource policy; }其中 type 和 subtype 可为下列其中一个值。表 8。 resourcedetach 探针:类型和子类型值 资源类型 描述 R_NADA 无 - 无效指定 R_PROCESS 处理 R_RSET 资源集 R_SUBRANGE 内存范围 R_SHM 共享内存 R_FILDES 已打开文件所标识的文件 R_THREAD 线程 R_SRADID SRAD 标识 R_PROCMEM 进程内存 其他受支持内置项
__errno__kernelmode,__arg1 to __arg7,__mst,__tid,__pname.执行环境
在进程环境中运行。
- drphasestart
系统将调用 dr 处理程序时,将触发此探针。
语法:
@@sysproc:drphasestart:*受支持的特殊内置项
__drphaseinfo{ dr_operation; ← dr operation dr_flags; dr_phase; handler_rc; ← always 0 in drphasestart }dr_operation 可具有下列其中一个值:
- DR 操作
- DR_RM_MEM_OPER
- DR_ADD_MEM_OPER
- DR_RM_CPU_OPER
- DR_ADD_CPU_OPER
- DR_CPU_SPARE_OPER
- DR_RM_CAP_OPER
- DR_ADD_CAP_OPER
- DR_RM_RESMEM_OPER
- DR_PMIG_OPER
- DR_WMIG_OPER
- DR_WMIG_CHECKPOINT_OPER
- DR_WMIG_RESTART_OPER
- DR_SOFT_RES_CHANGES_OPER
- DR_ADD_MEM_CAP_OPER
- DR_RM_MEM_CAP_OPER
- DR_CPU_AFFINITY_REFRESH_OPER
- DR_AME_FACTOR_OPER
- DR_PHIB_OPER
- DR_ACC_OPER
- DR_CHLMB_OPER
- DR_ADD_RESMEM_OPER
dr 标记可以是下列值的组合:- 标志
- DRP_FORCE
- DRP_RPDP
- DRP_DOIT_SUCCESS
- DRP_PRE_REGISTERED
- DRP_CPU DRP_MEM DRP_SPARE
- DRP_ENT_CAP
- DRP_VAR_WGT
- DRP_RESERVE
- DRP_PMIG DRP_WMIG
- DRP_WMIG_CHECKPOINT
- DRP_WMIG_RESTART
- DRP_SOFT_RES_CHANGES
- DRP_MEM_ENT_CAP
- DRP_MEM_VAR_WGT
- DRP_CPU_AFFINITY_REFRESH
- DRP_AME_FACTOR
- DRP_PHIB
- DRP_ACC_UPDATE
- DRP_CHLMB
其他受支持内置项
__errno__kernelmode,__arg1 to __arg7,__tid执行环境
在进程或中断环境中运行。
示例