linuxembedded-linuxtracelttng

Can I view LTTng traced Userspace events and Kernel events together in Trace Compass?


I am using LTTng to trace kernel events and userspace tracepoints. I want to visualize them together in one Trace Compass window. However, LTTng saves kernel events and userspace events in separate trace files which disallows me to view them together in Trace Compass.

Does anyone here know how to either:

(1) save both kinds of events in a single file ?, or

(2) use Trace Compass to combine info from 2 trace files ?


Details:

I am using LTTng to trace two kinds of events:

(1) Kernel sched_switch events (when the scheduler causes context switches)

(2) Userspace custom tracepoints (I named them setMarkerTracepoint and are posted from my C++ program)

I use the following commands to setup tracing session and start tracing

# trace data is saved at TRACE_DIR
TRACE_DIR=/home/root/lttng-traces
lttng-sessiond --daemonize
lttng create my-session --output=$TRACE_DIR
lttng enable-event --userspace tracepointProvider:setMarkerTracepoint
lttng enable-event --kernel sched_switch
lttng start

Then, I run my C++ application and stop LTTng tracing after my application has ended.

lttng destroy

Now, when I check where my trace data was saved, I find 2 locations with trace data:

(1) /home/root/lttng-traces/kernel/

(2) /home/root/lttng-traces/ust/

I use Trace Compass to visualize traces. The file under kernel directory has all the sched_switch events but doesn't have setMarkerTracepoint events. The file under ust directory has the vice-versa.

Trace with kernel events but doesn't have userspace tracepoints

Trace with userspace tracepoint but doesn't have kernel events

I want to view both sched_switch events and my tracepoints in my C++ code in the same Trace Compass window.

Trace Compass's user guide and LTTng Documentation doesn't talk about using kernel tracing and userspace tracing together.

I think this should be possible to do because if I use lttng-view command with babeltrace installed, I can see both kinds of events listed in the info printed out by lttng-view.

Any help will be appreciated! :)


Solution

  • In tracecompass combining multiple types of trace or traces is done via an "Experiment".

    You can follow this documentation section:Creating an Experiment