Alan Hargreaves' Blog

The ramblings of an Australian SaND TSC* Principal Field Technologist

Gman’s DTrace moment

Just noticed Glynn had a DTrace moment.

He was simply looking at the entry probes.

I’m sure he’ll find the following even more interesting (remember that this script will need ctrl-c to exit it):

#!/usr/sbin/dtrace -s
#pragma D option flowindent
pid$target:gedit::entry,
pid$target:gedit::return
{}

This one will show the entry and exit of user space functions, in addition to indenting for each stack level. Showing stuff like:

2  -> gedit_tooltips_event_handler
2    -> get_keyboard_mode
2     gedit_tooltips_data_get
2    <- gedit_tooltips_data_get
2  <- gedit_tooltips_event_handler

Of course you could get even more interesting with the following:

#!/usr/sbin/dtrace -s
#pragma D option flowindent
pid$target:gedit::entry
/!self->interest/
{self->interest = 1}
pid$target:::entry,
pid$target:::return
/self->interest/
{trace(probemod)}

I’ll leave it as an exercise to the reader as to what this one adds in. Hint, you might want to redirect the output, there is likely to be a bit.

For those who are a little more game, you could try adding the following to the previous script. Be aware that it’s going to make things a little busy for a bit. Don’t forget ctrl-c to exit it. It wil take a little bit to catch up after the ctrl-c.

fbt:::
/self->interest/
{trace("KERNEL")}

Technorati Tags: ,
,

Advertisements

Written by Alan

November 8, 2005 at 10:34 pm

Posted in OpenSolaris

%d bloggers like this: