On Wed, Dec 16, 2009 at 2:13 PM, Chad Mynhier <cmynh...@gmail.com> wrote: > On Wed, Dec 16, 2009 at 1:52 PM, Hillel (Sabba) Markowitz > <sabbahil...@gmail.com> wrote: >> >> As can be seen, if recursive code is used, the self->ts gets reset to >> timestamp with every entry, and the innermost exit causes a time to be >> calculated and the ts to be reset. The rest of the returns within the >> recursion will be ignored because of the conditional. >> >> I would like to know if someone has already done this before I try to >> reinvent the wheel or if there is a tool in the dtrace toolkit to do >> this already. > > You'll need to keep an array of timestamps indexed on ustackdepth. > Something like this (it appears that ustackdepth on entry doesn't > actually match ustackdepth on return): > > pid$target:*.so::entry > { > self->ts[probemod, probefunc, ustackdepth] = timestamp; > } > > pid$target:*.so::return > / self->ts[probemod, probefunc, ustackdepth + 1] / > { > �...@func_time[probemod, probefunc] = sum(timestamp - > self->ts[probemod, probefunc, ustackdepth + 1]); > self->ts[probemod, probefunc, ustackdepth + 1] = 0; > } > > Chad >
Thanks, this looks good. I will try it and see how it works. -- Sabba - סבא הלל - Hillel Hillel (Sabba) Markowitz | Said the fox to the fish, "Join me ashore" sabbahil...@gmail.com | The fish are the Jews, Torah is our water http://photos1.blogger.com/blogger/7637/544/640/SabbaHillel.jpg _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org