[lttng-dev] tracelog / tracef feature
nolange79 at gmail.com
Wed May 19 07:19:27 EDT 2021
I finally got some time digging into Lttng (using it on Xenomai, see
 for historic reference).
Since we have a hard realtime system, I chosen to use dynamic probes.
That means only
liblttng-ust-tracepoint.so wil get pulled into the process (it its
available), no threads are spawned, etc.
This is to minimize potential issues, without dealing with compiletime
(Pre-)loading the tracepoint library will then pull in
liblttng-ust.so. So far so good,
but I found out that tracepoint/tracef are unusable currently.
First you need to link with liblttng-ust.so, then you have vasprintf
doing memory allocations.
I did a custom solution with dynamic loading.
# Outlined custom solution
The own binary gets a sourcefile similar to
There is no need to add the definition to the own tracepoint library,
the binaries tracepoint library will depend on `liblttng-ust.so` and
are pulled in if the tracepoint library is loaded.
There are a own namespaces variant of macros and wrapper functions
Thats a short recap, easier to quote and address whether some upstream
solution is possible
### Use tracelog / tracef with dynamic probes
is there an easy solution for doing this?
is the solution of creating the stubs yourself valid?
### Allocations in the tracelog / tracef functions
Would you accept a change, where first some buffer on the stack and
vsnprintf is used,
only in case the buffer is to small a dynamic one will be allocated?
### No Include guards in lttng/lttng-ust-tracelog.h and lttng/lttng-ust-tracef.h
Some other issue is that `<lttng/lttng-ust-tracelog.h>` does not have
and including both the custom implementation and `<lttng/tracelog.h>` will
lead to duplicate definitions and compile errors.
 - https://lists.lttng.org/pipermail/lttng-dev/2019-November/029410.html
More information about the lttng-dev