以下面脚本(hello.d
)为例,讲述执行DTrace
脚本的方法:
BEGIN
{
/* This is a C-style comment */
trace("hello, world");
exit(0);
}
(1)在命令行运行dtrace -s hello.d
命令:
# dtrace -s hello.d
dtrace: script 'hello.d' matched 1 probe
CPU ID FUNCTION:NAME
0 1[......]