开发者

Can I ask dtrace what probes are enabled?

If it matters, I am using Mac OS X, but I believe this would apply across OSs. If the answer is different per OS, I would be interested in learning about that as well.

Let's say that I open a terminal window, enable a few probes, and start collecting data with DTrace.

From a different 开发者_开发知识库terminal window, can I ask DTrace what probes have been enabled? If so, how?


I got the following information from Adam Leventhal on a DTrace mailing list. First, he provided this script, which works on Solaris

#!/usr/sbin/dtrace -s

#pragma D option quiet

int i;

tick-100
/i >= `dtrace_nprobes/
{
       exit(0);
}

tick-100
{        printf("%4d %10s %20s %20s %10s %s\n", i,
           stringof(`dtrace_probes[i]->dtpr_provider->dtpv_name),
           stringof(`dtrace_probes[i]->dtpr_mod),
           stringof(`dtrace_probes[i]->dtpr_func),
           stringof(`dtrace_probes[i]->dtpr_name),
           `dtrace_probes[i]->dtpr_ecb != NULL ? "enabled" : "disabled");
       i++
}

Unfortunately, the same kernel variables are not available on Mac OS X due to a bug.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜