diff options
author | Harald Welte <laforge@osmocom.org> | 2020-09-26 11:51:32 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-02-03 13:55:40 +0000 |
commit | 433005c87c88912358bfd02d4b0d997b52b04013 (patch) | |
tree | d5f71f3faff20b53daf14a4975b33b3284babe1d /src/logging.c | |
parent | dc43f7d3c73dc4cbe4e94668c635f056756f6d8a (diff) |
initial support for static userspace probes via systemtap
This adds a --enable-systemtap configure option, which will then
add static tracepoints to the generated libosmocore binary.
At this point, only two tracepoints are supported: log_start
and log_done. They can be used to trace the amount of time
a libosmocore-using application spends in potentiall blocking calls to
log to stderr or to files.
Related: OS#4311
Change-Id: I7e1ab664241deb524c9582cbd1bec31af46c747e
Diffstat (limited to 'src/logging.c')
-rw-r--r-- | src/logging.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/logging.c b/src/logging.c index 60dba64c..a40008e9 100644 --- a/src/logging.c +++ b/src/logging.c @@ -44,6 +44,17 @@ #include <syslog.h> #endif +#ifdef HAVE_SYSTEMTAP +/* include the generated probes header and put markers in code */ +#include "probes.h" +#define TRACE(probe) probe +#define TRACE_ENABLED(probe) probe ## _ENABLED() +#else +/* Wrap the probe to allow it to be removed when no systemtap available */ +#define TRACE(probe) +#define TRACE_ENABLED(probe) (0) +#endif /* HAVE_SYSTEMTAP */ + #include <time.h> #include <sys/time.h> #include <errno.h> @@ -670,9 +681,11 @@ void logp2(int subsys, unsigned int level, const char *file, int line, int cont, { va_list ap; + TRACE(LIBOSMOCORE_LOG_START()); va_start(ap, format); osmo_vlogp(subsys, level, file, line, cont, format, ap); va_end(ap); + TRACE(LIBOSMOCORE_LOG_DONE()); } /*! Register a new log target with the logging core |