Hi David,

On 5/7/25 12:50 PM, David Aldrich via lttng-dev wrote:
Hi

I am just getting started with LTTng. I am trying to use
lttng_ust_tracef() initially.

I am running LTTng version 2.13 on Ubuntu 24.04 LTS, and viewing using
TraceCompass 10.3.0 on Windows 11.

I use  lttng_ust_tracef() in just one source file:

#include <lttng/tracef.h>
<snip>
{
     int my_integer = 0;
     string my_string = "Normal";
     lttng_ust_tracef("TaskManager: %d (%s)", my_integer, my_string.c_str());
}

I build with CMake and link to the lttng-ust library:

target_link_libraries(${_lib_name} lttng-ust)

On the target I created a session and enabled the event:


Was the lttng-sessiond already started (as the root user) when you can `lttng create my_proj`?

Is your user a member of the `tracing` group?

$ lttng create my_proj
$ lttng enable-event --userspace 'lttng_ust_tracef:*'



I have to run the application as root:


Do you have a particular reason to use `lttng-record-trace`? It looks like `lttng-record-trace` will set up a new session rather than use the one you created earlier.

sudo -E lttng-record-trace -a ./my_app

Should you application run as root normally?

Your commands could look like:

```
lttng create my_proj
lttng enable-event --userspace 'lttng_ust_tracef:*'
lttng start
./my_app
lttng stop
lttng view # [Optional]
```


When I import the trace directory into TraceCompass I tick both the
kernel and ust event boxes, and create an experiment, but then only
'kernel' shows under the experiments and Traces in the tree view, no
ust branch is shown.

I guess this isn't much to go on, but if anyone has any ideas why it's
not capturing ust events, I would be grateful.


You can also run the application with the environment variable `LTTNG_UST_DEBUG=1`, which will produce some output on stderr that you can use to diagnose issues.

The verbose log from lttng-sessiond may also help. (Run it with `-vvv --verbose-consumer`)

Finally, which 'event_type' should I search for in the event viewer
for lttng_ust_tracef events?


The event type is `lttng_ust_tracef:event`.

Best regards
David

thanks,
kienan

Reply via email to