summaryrefslogtreecommitdiffstats
path: root/src/util/probes.h
Commit message (Collapse)AuthorAgeFilesLines
* BUILD: Add build infrastructure for systemtap scriptsJakub Hrozek2016-06-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds infrastructure that generatest the probes.h and probes.o from the dtrace probes.d file. The probes.d file is empty except for the provider name in this commit, its content will be added with later commits that actually add some content. The probes.d file is always distributed in the tarball so that distributions can optionally enable systemtap support. The generation is done using the "dtrace" command because the probes.d file is compatible with the Solaris dtrace format. Please see "man 1 dtrace" for more information on the dtrace format and the command line tool. In order to make libtool happy, a fake libtool object is generated. This hunk was taken from the libvirt code. The AM_V_GEN macro is used to make the build compatible with the silent build configuration. To enable systemtap probing, configure sssd with: --enable-systemtap In order to do so, the 'dtrace' command-line utility must be installed. On Fedora and RHEL, this package is installed as part of the "systemtap-sdt-devel" package. You'll also want the 'systemtap' package installed as well as the matching versions of kernel-devel and kernel-debuginfo on your machine. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* UTIL: Add a PROBE macro into probes.hJakub Hrozek2016-06-101-0/+44
The macros are inspired by very similar macros in libvirt code. Adds a macro PROBE that can be used by SSSD developers to add systemtap marks to code. These marks, when coupled with a location in a binary can be in turn used to call probes. The mark can be called like this: PROBE(PROBE_NAME, arguments) This is cleaner than using the SSSD_$(PROBE_NAME) directly as it directly shows that a probe is being called at that place. If the systemtap tracing is disabled, they would expand to an empty macro. If the systemtap tracing is enabled, the systemtap probe will be called. The overhead of calling the probes is close to zero. As one of the systemtap developers explained to me: """ STAP_PROBE() macros cost apprx. one nop in the executable, so apprx. no cost at all. The more the merrier. Only when activated by a stap script do we generally think of it like a microsecond of time. """ The probe arguments can be used in the probes to be printed or passed on to functions. There was an issue in case a string argument was NULL. This commit adds a helper macro to deal with NULL-strings as if they were empty (""). This file would be included by any source file that wants to call the PROBE() macro. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>