Performance probes
Alan DeKok
aland at deployingradius.com
Tue Oct 15 14:03:18 CEST 2013
Phil Mayers wrote:
> https://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
Looking at the page some more, here's my $0.02.
- ignore the configure checks for sys/std.h, unless you're a masochist.
Arran or I will get that going. For testing, you can just manually add
#define entries to src/include/autoconf.h
- I'd put the changes into src/include/log.c:
/*
* Catch brokenness
*/
#ifdef WITH_DTRACE_PROBES
#ifndef HAVE_SYS_STD_H
#undef WITH_DTRACE_PROBES
#endif
...
// typical pattern
#ifdef HAVE_SYS_SDT_H
#include <sys/sdt.h>
#endif
// create empty defines if they don't exist
#ifndef WITH_DTRACE_PROBES
#define DTRACE_PROBE(_x, _y)
#define ...
// anything else here to avoid #ifdef's in the code
#endif
For the actual probes, use:
DTRACE_PROBE(progname, ...)
Because "progname" is a global which is the base name of the binary.
e.g. /usr/sbin/radiusd -> radiusd.
That lets it automatically change the probe names if we want to run
the server as "radrelay", for example.
And then sprinkle the probes everywhere. I'd suggest
src/main/modcall.c for the various modules. And src/main/threads.c for
the queue / dequeue work. And src/main/process.c for the various state
machine handling.
I can then use dtrace on my Mac to debug performance issues. Nice!
Alan DeKok.
More information about the Freeradius-Devel
mailing list