[dtrace-discuss] DTracing GNOME startup

Michael Schuster Michael.Schuster at Sun.COM
Thu Jul 5 17:20:06 PDT 2007


Alberto Ruiz wrote:

> I would appreciate any kind of script examples that help me to 
> understand what I need to create the proper scripts to provide federico 
> what is he asking for.

I'd start with something like this:

syscall::poll:entry
{
	self->poll_ts = timestamp;
}

syscall::poll:return
/self->poll_ts/
{
	self->poll_duration = timestamp - self->poll_ts;
	self->poll_ts = 0;
}

to get useful information, you need to
- check for the process(es) of interest (either use pid$target somewhere 
and set something you can use in a predicate, or use /execname == "..."/ ...
- actually do something useful with self->poll_duration - some aggregation 
(quantize) comes to mind, but I haven't played^Wexperimented with anything 
but sum enough to give any useful advice.

you'll also see that while poll is a system call, select isn't, so the 
syscall provider doesn't know about it. You'll have to do something like

	 pid$target:libc:select:entry

(don't nail me down on the exact syntax!) for that. the pid provider can 
not "watch" more than one process at a time (that I know of), so if you 
don't know which proc you're looking for yet, this may involve some 
source-code perusal on your part to see which syscalls are involved to 
uniquely map this back to the select library call.

I also invite you to go to opensolaris.org and have a look at the DTrace 
community page http://www.opensolaris.org/os/community/dtrace/, where 
there's lots of examples to be found.

I hope this helps
Michael
-- 
Michael Schuster
Recursion, n.: see 'Recursion'


More information about the dtrace-discuss mailing list