Developer Guide Release

Linux Tracing Toolkit
The Linux Tracing Toolkit Next Generation 2.7.x (lttng) is packaged as lttng.tgz tarball 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 packages are available at:
Once the run file is extracted, the packages are available at:
To use the tracing toolkit
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 chapter in the NVIDIA DRIVE OS 5.1 Linux PDK Development Guide. 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 commands:
make ARCH=arm64 CROSS_COMPILE=<top>/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- KERNELDIR=<top>/drive-oss-src/out-t186ref-linux/
sudo make ARCH=arm64 CROSS_COMPILE=<top>/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- 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 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.