This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
TRACE macro for userspace probes
- From: Eric Wong <normalperson at yhbt dot net>
- To: systemtap at sourceware dot org
- Date: Thu, 18 Apr 2013 21:38:50 +0000
- Subject: TRACE macro for userspace probes
I'm reading:
http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
And I see the following for defining the no-op TRACE macro:
----------------------- trace.h --------------------
#include "config.h"
#ifdef HAVE_SYSTEMTAP
// include the generated probes header and put markers in code
#include "probes.h"
#define TRACE(probe) probe
#else
// Wrap the probe to allow it to be removed when no systemtap available
#define TRACE(probe)
#endif
----------------------------------------------------
Should there also be a TRACE_ENABLED macro in case we're using
_ENABLED() checks in our code?
So, something like this, instead:
------------------- trace.h (proposed) -------------
#include "config.h"
#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
----------------------------------------------------
Perhaps there is a better way...