[lttng-dev] Creating custom application

Jonathan Rajotte-Julien jonathan.rajotte-julien at efficios.com
Wed Mar 27 13:52:51 EDT 2019

Hi Mosleh,

On Wed, Mar 27, 2019 at 12:09:54PM -0400, Mosleh Uddin wrote:
> Hello,
> Thank you for the quick response. I was able to use the documentation you
> provided to start a session and get tracepoint list. I do have some
> follow-up questions:
> 1) I needed to create a session daemon before executing my custom
> application. In the API I did see functionality to see if a daemon is
> active, however, it is possible to spawn a session daemon in my custom app?

liblttng-ctl does not expose a lttng-sessiond spawning function since by
definition it is a daemon executable (think apache,mysql etc.), you will have to
use system/popen/exec.. to spawn the lttng-sessiond process etc. if you want to
control its lifetime using your custom application.

> 2) I am able to get a list of active traces lttng can see in userspace, I
> enable all the traces and start tracing. The traces however seem to not be
> written anywhere on my filesystem. Do I have to specify a location? Or am I
> missing something? My current flow is:

Please refer to the create command. If outputting locally you will need to pass
a "file://...." url to lttng_create_session.

You can check on the result for each steps using "lttng list" and "lttng list
<session_name>" as you go to troubleshot your setup script.

While debugging you can also start the lttng-sessiond in verbose mode to
understand what is going on.

Also note that you could also use the lttng "load" api if the session you are
trying to load is "static" and always the same. You would only need to ship an
xml file with your application.


>    - Creating a session
>    - Specifying the domain
>    - Creating a handle
>    - Creating a channel (with default attributes)
>    - Enabling the channel
>    - Enabling event (for all traces)
>    - Start tracing
> Thanks again for all the assistance.
> Regards,
> Mosleh
> On Tue, Mar 26, 2019 at 11:29 AM Jonathan Rajotte-Julien <
> jonathan.rajotte-julien at efficios.com> wrote:

More information about the lttng-dev mailing list