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 _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org