* Not capturing ust events
@ 2025-05-07 16:50 David Aldrich via lttng-dev
2025-05-08 13:51 ` Kienan Stewart via lttng-dev
0 siblings, 1 reply; 5+ messages in thread
From: David Aldrich via lttng-dev @ 2025-05-07 16:50 UTC (permalink / raw)
To: lttng-dev
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:
$ lttng create my_proj
$ lttng enable-event --userspace 'lttng_ust_tracef:*'
I have to run the application as root:
sudo -E lttng-record-trace -a ./my_app
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.
Finally, which 'event_type' should I search for in the event viewer
for lttng_ust_tracef events?
Best regards
David
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Not capturing ust events
2025-05-07 16:50 Not capturing ust events David Aldrich via lttng-dev
@ 2025-05-08 13:51 ` Kienan Stewart via lttng-dev
2025-05-08 17:02 ` David Aldrich via lttng-dev
0 siblings, 1 reply; 5+ messages in thread
From: Kienan Stewart via lttng-dev @ 2025-05-08 13:51 UTC (permalink / raw)
To: David Aldrich, lttng-dev
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Not capturing ust events
2025-05-08 13:51 ` Kienan Stewart via lttng-dev
@ 2025-05-08 17:02 ` David Aldrich via lttng-dev
2025-05-08 17:25 ` Kienan Stewart via lttng-dev
0 siblings, 1 reply; 5+ messages in thread
From: David Aldrich via lttng-dev @ 2025-05-08 17:02 UTC (permalink / raw)
To: Kienan Stewart; +Cc: lttng-dev
Hi Kienan
Thanks very much for your reply. I can now capture UST events. (My
actual problem was that I was not linking to lttng-ust).
I am now using the method you described:
> lttng create my_proj
> lttng enable-event --userspace 'lttng_ust_tracef:*'
> lttng start
> ./my_app
> lttng stop
> lttng view # [Optional]
This works and captures UST events but I am not capturing Kernel
events. My reason for running this experiment is that occasionally
our application shows glitches where a task takes longer than
expected. So I want to see what happens in that occurrence - perhaps
an ISR is running or something like that. So I assume that I need to
capture Kernel and UST events.
Can you please advise me why Kernel events aren't being captured?
Best regards
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Not capturing ust events
2025-05-08 17:02 ` David Aldrich via lttng-dev
@ 2025-05-08 17:25 ` Kienan Stewart via lttng-dev
2025-05-08 17:59 ` David Aldrich via lttng-dev
0 siblings, 1 reply; 5+ messages in thread
From: Kienan Stewart via lttng-dev @ 2025-05-08 17:25 UTC (permalink / raw)
To: David Aldrich; +Cc: lttng-dev
Hi David,
On 5/8/25 1:02 PM, David Aldrich wrote:
> Hi Kienan
>
> Thanks very much for your reply. I can now capture UST events. (My
> actual problem was that I was not linking to lttng-ust).
>
Glad you caught that. I had assumed it was linked in :)
> I am now using the method you described:
>
>> lttng create my_proj
>> lttng enable-event --userspace 'lttng_ust_tracef:*'
>> lttng start
>> ./my_app
>> lttng stop
>> lttng view # [Optional]
>
> This works and captures UST events but I am not capturing Kernel
> events. My reason for running this experiment is that occasionally
> our application shows glitches where a task takes longer than
> expected. So I want to see what happens in that occurrence - perhaps
> an ISR is running or something like that. So I assume that I need to
> capture Kernel and UST events.
>
> Can you please advise me why Kernel events aren't being captured?
>
In the setup above, only a userspace channel is created.
Assuming the user you are running the `lttng` commands with is a member
of the tracing group and a root lttng-sessiond is running, a complete
example might look like:
```
lttng create my_proj
lttng enable-event --userspace 'lttng_ust_tracef:*' # this will
automatically create a channel if one doesn't exist in the session
lttng enable-channel --kernel --session my_proj kernel_channel # [1]
lttng enable-event --kernel --all --channel kernel_channel --session
my_proj # [2]
lttng start
./my_app
lttng stop
lttng view
```
> Best regards
> David
thanks,
kienan
[1]: https://lttng.org/man/1/lttng-enable-channel/v2.13/
[2]: https://lttng.org/man/1/lttng-enable-event/v2.13/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Not capturing ust events
2025-05-08 17:25 ` Kienan Stewart via lttng-dev
@ 2025-05-08 17:59 ` David Aldrich via lttng-dev
0 siblings, 0 replies; 5+ messages in thread
From: David Aldrich via lttng-dev @ 2025-05-08 17:59 UTC (permalink / raw)
To: Kienan Stewart; +Cc: lttng-dev
Hi Kienan
Thanks again for replying.
> Glad you caught that. I had assumed it was linked in :)
Yes, I should have spotted that earlier!
> Assuming the user you are running the `lttng` commands with is a member
> of the tracing group and a root lttng-sessiond is running, a complete
> example might look like:
>
> ```
> lttng create my_proj
> lttng enable-event --userspace 'lttng_ust_tracef:*' # this will
> automatically create a channel if one doesn't exist in the session
> lttng enable-channel --kernel --session my_proj kernel_channel # [1]
> lttng enable-event --kernel --all --channel kernel_channel --session
> my_proj # [2]
> lttng start
> ./my_app
> lttng stop
> lttng view
> ```
I now see:
$ lttng enable-channel --kernel --session my_proj kernel_channel
Error: Channel kernel_channel: Tracing the kernel requires a root
lttng-sessiond daemon, as well as "tracing" group membership or root
user ID for the lttng client (session my_proj)
I am a member of the tracing group, however I need to understand how
to configure the daemon. I'll have another look at the docs.
Best regards
David
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-05-08 21:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-07 16:50 Not capturing ust events David Aldrich via lttng-dev
2025-05-08 13:51 ` Kienan Stewart via lttng-dev
2025-05-08 17:02 ` David Aldrich via lttng-dev
2025-05-08 17:25 ` Kienan Stewart via lttng-dev
2025-05-08 17:59 ` David Aldrich 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