DRIVE 5.0 Linux Open Source Software

Development Guide Release

Linux Tracing Toolkit
The Linux Tracing Toolkit Next Generation 2.7.x (lttng) is packaged as lttng.tgz tarball in the SDK and includes:
Additionally, the lttng-modules source is packaged as lttng-modules.tgz tarball. This source is compiled to create the modules that are required for kernel tracing.
Both these packages are available at:
The packages are available after you extract the run file at:
To use the tracing toolkit, you must:
Copy the source files to the target
Build and install the tookit on the target
Build the lttng-modules on the host
Run the tracing toolkit
Analyze the traces
To copy the tracing toolkit source files to the target
1. Create a src_target directory.
sudo mkdir <top>/drive-t186ref-linux/targetfs/root/src_target
2. Copy the tracing toolkit tarball to the src_target directory and untar the files.
sudo cp <top>/drive-t186ref-linux_src/lttng.tgz <top>/drive-t186ref-linux/targetfs/root/src_target
sudo tar -xvf <top>/drive-t186ref-linux/targetfs/root/src_target/lttng.tgz -C <top>/drive-t186ref-linux/targetfs/root/src_target/
To build and install the tracing toolkit on the target
On the target, for each component, update the shared library configuration and bootstrap as follows:
sudo /root/drive-setup.sh install-run-once-pkgs; reboot
cd ~/userspace-rcu
./bootstrap && ./configure && make -j4 && sudo make install
sudo ldconfig
cd ~/lttng-ust
./bootstrap && ./configure && make -j4 && sudo make install
sudo ldconfig
cd ~/lttng-tools
./bootstrap && ./configure && make -j4 && sudo make install
sudo ldconfig
sudo cp extras/lttng-bash_completion /etc/bash_completion.d/lttng
cd ~/babeltrace
./bootstrap && ./configure && make -j 4 && sudo make install
sudo ldconfig
To build the lttng-modules on the host
1. Rebuild the kernel and flash the target with the rebuilt kernel image.
For instructions on rebuilding the kernel see the Compiling the Kernel topic. For flashing instructions, see the “Flashing the Board” topic in the Foundation Development Guide.
2. Extract the lttng-modules.tgz tarball.
mkdir <top>/lttng-modules && tar xvf <top>/drive-t186ref-linux_src/lttng-modules.tgz -C <top>/lttng-modules
3. Navigate to the lttng-modules directory.
cd <top>/lttng-modules
4. Build and install the lttng-modules by executing the following commands:
make ARCH=arm64 CROSS_COMPILE=<top>/toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux- KERNELDIR=<top>/drive-oss-src/out-t186ref-linux/
sudo make ARCH=arm64 CROSS_COMPILE=<top>/toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux- KERNELDIR=<top>/drive-oss-src/out-t186ref-linux/ INSTALL_MOD_PATH=<top>/drive-t186ref-linux/targetfs/ modules_install
To run the tracing toolkit
1. Create a new session.
lttng create <session_name>
2. Enable events to trace.
lttng enable-event -k -a
3. Start the trace.
lttng start
4. Stop the trace.
lttng stop
5. Stop the tracing session.
lttng destroy
All the collected traces are present in a lttng-traces directory on the target system.
For more information on the Linux Trace Toolkit, see:
To analyze the traces on the host with TraceCompass
1. Create a src_host directory.
cd ~/src_host/
2. In the src_host directory, download the Trace Compass application from:
3. Copy the tracing toolkit tarball to the src_target directory and untar the files.
tar -xvf trace-compass-<ver>
Where: <ver> is the version of the TraceCompass.
4. Launch TraceCompass by executing the following command.
sudo ./tracecompass
5. From the File menu, select Open Trace dropdown, then select Trace.
This opens the Trace in <top>/drive-t186ref-linux/targetfs/root/lttng-traces/<name_of_trace>/kernel/<channel0_0>
<name_of_trace> is the name of the desired trace you are analyzing.
<channel0_0> is the channel for the trace you are analyzing.
6. Analyze the trace as necessary.