[dtrace-discuss] Error trying to count return points in functions.
Brendan Gregg - Sun Microsystems
brendan at sun.com
Tue Jul 10 23:34:25 PDT 2007
G'Day Darren,
On Tue, Jul 10, 2007 at 06:46:55PM -0700, Darren.Reed at Sun.COM wrote:
> Whilst trying out some D to get an insight into what is the most
> common reason for a given function to return, I have bumped
> into an error I don't understand.
>
> The first take on what I was trying to do was:
> # dtrace -n 'fbt:ip:ip_input:return{@home[arg0] = count();}'
>
> and all was well. The next step was:
> # dtrace -n 'fbt:ip::return{@home[strjoin(probefunc,(string)arg0)] =
> count();}'
>
> but the output was not quite so friendly:
> dtrace: description 'fbt:ip::return' matched 1653 probes
> dtrace: error on enabled probe ID 1574 (ID 23867:
> fbt:ip:ip_loopback_src_or_dst:return): invalid address (0x30) in action
> #2 at DIF offset 48
> dtrace: error on enabled probe ID 769 (ID 25479:
> fbt:ip:ilm_lookup_ill:return): invalid address (0x52) in action #2 at
> DIF offset 48
> ...
>
> and all is not well. I've also tried stringof(arg0) but the result is
> similar.
Both "(string)" and "stringof()" are attempting to dereference a "char *".
arg0 is a uint. If you wanted to append it to the probefunc using strjoin(),
then you can turn it into a string using lltostr().
A better way may be to make it a 2-key hash,
# dtrace -n 'fbt:ip::return { @[probefunc, arg0] = count(); }
END { printa(" %32s+%#-8x %@8d\n", @); }'
no worries,
Brendan
--
Brendan
[CA, USA]
More information about the dtrace-discuss
mailing list