You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Basant Kukreja <Ba...@Sun.COM> on 2008/08/23 06:27:19 UTC

Re: dtrace in apache

Hi,
   I agree with Rahul. pid provider can be used to trace apr calls. Following
dscript traces apr calls in stock apache (without any probes)

pid*::apr_*:entry
/execname == "httpd"/
{
}

pid*::apr_*:return
/execname == "httpd"/
{
}
--------------------------------------
If apr calls would not have been started with prefix apr_ then putting a
specific probe might make more sense.

I have written a small blog for it.
http://blogs.sun.com/basant/entry/tracking_apr_calls_in_apache

Regards,
Basant.


On Sat, Aug 23, 2008 at 01:00:37PM +0530, rahul wrote:
> Hi,
> I was reviewing the omniti labs dtrace functions, at
> http://labs.omniti.com/trac/project-dtrace/browser/trunk/apache22/apr-util-hook-probes.patch
> This patch (util-hook) is committed into apache already.
> 
> I was concerned that quite a few were just tracing function boundaries,
> which the dtrace does already for us with out the necessity of USDT probes
> baked into the code.
> 
> For e.g in APR_IMPLEMENT_XXX macros, the below are inserted.
> but APR_IMPLEMENT_XXX macros already create function boundaries when
> they are called and these probes effectively duplicate the
> instrumentation available.
> 
> 
>  /**
>   * @file apr_hooks.h
>   * @brief Apache hook functions
> @@ -107,12 +124,21 @@
>      ns##_LINK_##name##_t *pHook; \
>      int n; \
>  \
> -    if(!_hooks.link_##name) \
> -   return; \
> +    OLD_DTRACE_PROBE(name##__entry); \
>  \
> -    pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
> -    for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
> -   pHook[n].pFunc args_use; \
> +    if(_hooks.link_##name) \
> +        { \
> +        pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
> +        for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
> +            { \
> +            OLD_DTRACE_PROBE1(name##__dispatch__invoke, (char
> *)pHook[n].szName); \
> +       pHook[n].pFunc args_use; \
> +            OLD_DTRACE_PROBE2(name##__dispatch__complete, (char
> *)pHook[n].szName, 0); \
> +            } \
> +        } \
> +\
> +    OLD_DTRACE_PROBE1(name##__return, 0); \
> +\
>      }
> 
> 
> What do you think?
> 
>                                     rahul
> --
> 1. e4 _