Well, with a little research, I believe I was able to find the answer to 
determine what was available in Mac OS X.

Just execute:  nm -j /mach_kernel

and, of course, one can do: nm -j /mach_kernel | grep dtrace

to see which ones are dtrace related. As expected, dtrace_nprobes & 
dtrace_probes aren't in the list. I didn't see anything that looked promising, 
but perhaps someone else may be able to spot something.

I am wondering...let's say I did see something that looked promising, how would 
I go about determining the structure? How would I know that I could do <some 
var>->something and see some meaningful data? How might someone who didn't 
already know, know that dtpr_name was part of dtrace_probes[i] - i.e. that one 
could do `dtrace_probes[i]->dtpr_name? Is the only way by inspecting the kernel 
code itself or is thing kind of thing documented somewhere?

Thank you.



On Jun 21, 2011, at 4:12 PM, Eric Gorr wrote:

> Thanks. This is quite interesting. I wonder where one goes to learn about 
> what kernel symbols are available in Mac OS X...?
> 
> On Jun 21, 2011, at 12:17 PM, Adam Leventhal <a...@delphix.com> wrote:
> 
>> Hey Eric,
>> 
>> There's not a great way to do it, but you can use a tool like mdb(1)
>> on Solaris, or a simple DTrace script:
>> 
>> ---8<--- dtrace_probes.d ---8<---
>> 
>> #!/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++
>> }
>> 
>> ---8<--- dtrace_probes.d ---8<---
>> 
>>  0     dtrace                                                BEGIN disabled
>>  1     dtrace                                                  END disabled
>>  2     dtrace                                                ERROR enabled
>>  3  python589  libpython2.6.so.1.0   PyEval_EvalFrameEx
>> function-entry disabled
>>  4  python589  libpython2.6.so.1.0         dtrace_entry
>> function-entry disabled
>> 
>> Unfortunately this doesn't work on Mac OS X:
>> 
>> # dtrace -n 'BEGIN{ trace(`dtrace_nprobes); }'
>> dtrace: invalid probe specifier BEGIN{ trace(`dtrace_nprobes); }: in
>> action list: failed to resolve `dtrace_nprobes: Unknown symbol name
>> 
>> Some kernel symbols seem to be available; perhaps someone more
>> familiar with Mac OS X can get this script running over there.
>> 
>> Adam
>> 
>> On Tue, Jun 21, 2011 at 5:01 AM, Eric Gorr <mail...@ericgorr.net> wrote:
>>> If it matters, I am using Mac OS X 10.6.x.
>>> 
>>> Let's say that I open a terminal window, enabled a few probes, and start 
>>> collecting data.
>>> 
>>> From a different terminal window can I ask DTrace what probes have been 
>>> enabled? If so, how?
>>> 
>>> Thank you.
>>> _______________________________________________
>>> dtrace-discuss mailing list
>>> dtrace-discuss@opensolaris.org
>>> 
>> 
>> 
>> 
>> -- 
>> Adam Leventhal, Delphix
>> http://dtrace.org/blogs/ahl
>> 
>> 275 Middlefield Road, Suite 50
>> Menlo Park, CA 94025
>> http://www.delphix.com
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org

_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to