[lttng-dev] Instrumenting code that's common between user and kernel space

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Sat Sep 12 12:49:19 EDT 2015


----- On Aug 31, 2015, at 3:13 PM, Shelton, Ben benjamin.h.shelton at intel.com wrote:

> Hi all,
> 
> I'm working on using LTTng to instrument a driver that has both a kernel
> space portion and a user space portion.  There is quite a bit of code
> that's common between the two.  Is there a recommended way to handle
> generating both the user space template files and the kernel space
> tracepoints / probes for the same code, or is this something we would
> need to build ourselves?

Hi Ben,

I would recommend creating separate files for the tracepoint
probe providers (the TRACEPOINT_EVENT() declarations) since those
differ slightly between lttng-modules and UST. Then, you could
do a wrapper macro for the tracepoint call: UST's API is
tracepoint(provider, name, args), whereas the kernel is
trace_eventname(args). Some preprocessor macro magic should
allow you to instrument code shared between userspace and kernel.

Hoping this helps,

Thanks for reaching out to us!

Mathieu


> 
> Thanks,
> Ben
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list