TRACE macro for userspace probes
Eric Wong
normalperson@yhbt.net
Thu Apr 18 21:38:00 GMT 2013
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...
More information about the Systemtap
mailing list