> > Are you talking about userland or kernel? > > I am talking about a userland application which does database queries. > To simplify, let's say main() calls A(). Sometimes A takes too long to > return, so I want to know what parameters were passed (maybe the query > is too broad or inefficient).
[...]
With dtrace you are out of luck at this time. But would it be too
inefficient to run DTrace all the time and log parameters every time you
enter the function ? If you set probe to both begin and end of the
function, you can easily measure the time it took, and log something
like
"param a, param b, param c -> 123 ms"
for every A() call you do.
Instead of running
$ query blah blah
You do
$ dtrace -o /var/tmp/log \
-c 'query blah blah' \
-n '
pid$target::A:entry
{
self->start = timestamp;
trace(arg0);
trace(arg1)
}
pid$target::A:return
/self->start/
{
trace(timestamp - self->start);
self->start=0;
}'
> If I run a DTrace script at this point,
> the pid$1::A:entry fbt provider will not be triggered and
> pid$1::A:return will be too late (because the problem does not exist
> anymore). If A() is a small function, then I could put a probe on every
> instruction but in this case it is complex and calls many other functions.
Hmm, one way to tackle this might be to find out first what makes the
query to take long (if possible, it might not be caused by the client
but rather by the server, in which case sampling client will not help).
Hope this helps
--
Vlad
pgpldGUYwFLgy.pgp
Description: PGP signature
_______________________________________________ dtrace-discuss mailing list [email protected]
