apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: comments on DTrace support for hooks
Date Tue, 15 Dec 2009 12:46:42 GMT
On Fri, Dec 11, 2009 at 3:21 PM, Jeff Trawick <trawick@gmail.com> wrote:
> I'll change the hook [D]trace support Real Soon now along these lines,
> before the apr-util 1.4.x API is frozen.

[w.r.t. to the state of the apr-util 1.4.x API: changes to the hook
hook probes are irrelevant; if someone installed an apr-util 1.4.0-dev
configured with --enable-dtrace, it would break any other apps
compiled against it that used hooks (presumably there was one key app
that had build support for the DTrace probes); in fact it would have
broken the httpd 2.3.4 with which it was distributed]

apr trunk patch: http://people.apache.org/~trawick/apr_hook_probes-trunk.txt
apr-util 1.4.x patch:
http://people.apache.org/~trawick/apr_hook_probes-1.4.x.txt

example code that uses it:

1. The apr trunk patch contains an update to the trunk-only hooks
testcase to utilize the probe capability.

2. A very quick and dirty trace hack to httpd, with sample output, is here:

http://people.apache.org/~trawick/httpd_hook_probes.txt

3. The DTrace implementations of the probes that generate the same
probes as in Theo's patch are as follows:

[This stays IN THE APP, not in APR.  The !defined(DTRACE_PROBE)
implementation matches Theo's patch and is necessary on some or all
levels of FreeBSD; the defined(DTRACE_PROBE) implementation works on
Leopard and *Solaris and provides a necessary function prototype for
the generated probe.]

#include <sys/sdt.h>

#define APR_HOOK_PROBES_ENABLED

#if defined(DTRACE_PROBE)

#define APR_HOOK_PROBE_ENTRY(ud,ns,name) \
  DTRACE_PROBE(ns, name##__entry); ud=NULL

#define APR_HOOK_PROBE_RETURN(ud,ns,name,rv) \
  DTRACE_PROBE1(ns, name##__return, rv)

#define APR_HOOK_PROBE_INVOKE(ud,ns,name,src) \
  DTRACE_PROBE1(ns, name##__dispatch__invoke, src)

#define APR_HOOK_PROBE_COMPLETE(ud,ns,name,src,rv) \
  DTRACE_PROBE2(ns, name##__dispatch__complete, src, rv)

#else

#define APR_HOOK_PROBE_ENTRY(ud,ns,name) \
  __dtrace_##ns##___##name##__entry(); ud=NULL

#define APR_HOOK_PROBE_RETURN(ud,ns,name,rv) \
  __dtrace_##ns##___##name##__return()

#define APR_HOOK_PROBE_INVOKE(ud,ns,name,src) \
  __dtrace_##ns##___##name##__dispatch__invoke(src)

#define APR_HOOK_PROBE_COMPLETE(ud,ns,name,src,rv) \
  __dtrace_##ns##___##name##__dispatch__complete(src, rv)

#endif

Mime
View raw message