Hi Sabba: You can use the ustackdepth variable. This has the stack depth in the user land. So use that as the array index.
-Angelo On Dec 16, 2009, at 1:52 PM, Hillel (Sabba) Markowitz wrote: > When tracing user functions, how are recursive functions handled. For > example, the following code processes the time spent within user > dynamic modules. The modules have user created dynamic libraries : > MyLib1.so, MyLib2.so, ... I would also like to know if there is > someting already in the dtrace toolkit that I can use. > > {code} > pid$target:*.so::entry > { > self->ts[probemod, probefunc] = timestamp; > } > > pid$target:*.so::return > /self->ts[probemod, probefunc]/ > { > @funct_time[probemod, probefunc] = sum(timestamp - > self->ts[probemod, probefunc]; > self->ts[probemod, probefunc] = 0; > {code} > > 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. > > -- > 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 _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org