* [lttng-dev] tracelog / tracef feature
@ 2021-05-19 11:19 Norbert Lange via lttng-dev
0 siblings, 0 replies; only message in thread
From: Norbert Lange via lttng-dev @ 2021-05-19 11:19 UTC (permalink / raw)
To: lttng-dev
Hello,
I finally got some time digging into Lttng (using it on Xenomai, see
[1] 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
selection/macros.
(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
```c
#define TRACEPOINT_DEFINE
#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
#include <lttng/lttng-ust-tracelog.h>
```
There is no need to add the definition to the own tracepoint library,
the binaries tracepoint library will depend on `liblttng-ust.so` and
the definitions
are pulled in if the tracepoint library is loaded.
There are a own namespaces variant of macros and wrapper functions
## Issues
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
include guards
and including both the custom implementation and `<lttng/tracelog.h>` will
lead to duplicate definitions and compile errors.
Regards, Norbert
[1] - https://lists.lttng.org/pipermail/lttng-dev/2019-November/029410.html
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-19 11:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 11:19 [lttng-dev] tracelog / tracef feature Norbert Lange via lttng-dev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).