Getting started

This is a small guide to get started quickly with LTTng kernel and userspace tracing.

Kernel Tracing

First make sure you have lttng-modules (the kernel modules) and lttng-tools installed.

To list the available kernel events:

# lttng list -k

Before starting, we need to create a session:

# lttng create mysession

Enable some events for this session:

# lttng enable-event sched_switch,sched_process_fork -k

or simply all available events:

# lttng enable-event -a -k

Start the tracing:

# lttng start

By default traces are saved in ~/lttng-traces/mysession-[date]-[time]/

When you're done:

# lttng stop
# lttng destroy

For a more exhaustive list of available options, see the lttng-tools wiki page.

User-space Tracing

To trace userspace applications, you need lttng-tools compiled with UST support (on by default), which requires the lttng-ust library.

Information about instrumenting applications can be found in the lttng-ust(3) manpage.

To trace an application instrumented with UST, see the Userspace Tracing section of the lttng-tools wiki page.

Reading a trace

To quickly make sure your trace is valid and contains information, you can display it in text with Babeltrace. With the default options, it simply reads the CTF trace passed as parameter and outputs the text dump to stdout. You can search in a trace using grep, for example:

$ babeltrace /path/to/trace/dir | grep sched_switch

For more extensive analyses, you can also use LTTngTop or TMF. Work is ongoing to bring CTF support to LTTV.