LTTng Trace Control Linux Project

Project LTTng Trace Control Linux Project example using GNU C/C++ compiler

This chapter covers the basics of C/C++ LTTng Trace Control Linux Project projects, including create/build/run/debug applications. This application sets up some tracepoints for tracing purposes when running the application. The application can also be built and run on QEMU emulator.

Components Prerequisites

To build, run and debug LTTng Trace Control Linux Project applications, please make sure that all below components are installed. Please refer to Component management for more information about installing component.

  • xplor-studio-tracecompass-plugin: Contains scripts to install Eclipse Tracecompass into XploR Studio
  • xplor-studio-linux-debug-plugin: Kernel XploR Studio Plugin using for kernel debugging
  • rv-linux-rootfs: RISC-V RootFS can be booted by QEMU and can run/debug RISC-V Embedded Linux applications
  • rv-qemu-linux64/rv-qemu-win64: QEMU for running and debugging RISC-V applications (Baremetal, Embedded, Embedded Linux)
  • linux-lttng-trace-example: LTTng Trace Control Linux Project source code.

All above components are compulsory for running Embedded Linux Trace Control applications. Depending on variation of toolchain, XploR Studio has 2 different Linux toolchain components:

  • rv64imac-xplor-linux-linux64/rv64imac-xplor-linux-win64: RISC-V Embedded Linux toolchain 64-bit (No Float)
  • rv64gc-xplor-linux-linux64/rv64gc-xplor-linux-win64: RISC-V Embedded Linux toolchain 64-bit (Double)

Each toolchain can be downloaded separately.

Creating & Building project

  1. To create a new project, select File > New > C Project choose RISC-V Embedded Linux Project > Linux Trace

example image

  1. Other steps (building project) are same as the quick-start project. Please refer to Quick start with FreeRTOS project for general working flow.

Tracing flow

Booting Linux

  • Right-click on project name > Run configurations > RISC-V Running > QEMU:

    • In Remote Absolute File Path for C/C++ Application: Type /home/root/riscv.elf (if missing)

    • Click on Enable LTTng Trace Control checkbox

    • Choose Apply and Run

    example image

  • Wait a few minutes for QEMU booting Linux:

    example image

Starting Trace session

Now we can start the Trace session by clicking on this button (in the top-right corner):

example image

and select LTTng Kernel and Open:

example image

The screen should be like this:

example image

In left corner, in Control tabs:

  • Create New Connection…

    example image

  • Select Default SSH-QEMU [localhost]:

    example image

  • Select Edit…:

    example image

    • Host: localhost

    • User: root

    • Password based authentication

  • Then Finish and OK

Now the Control View shows:

example image

Right-click on Sessions and select Create sessions:

example image

  • Enter Session Name

  • Choose Normal Mode and OK:

    example image

After create session, we can enable Kernel or UST event by Right-click on trace_1 > select Enable Event

example image

The Enable Events will be shown:

example image

  • Enable event with UST. Select UST (on Domain) > Select All Tracepoint Events or choose a event (For example: hello_world:my_first_tracepoint)

    example image

In Control View, information will be displayed in form of a tree structure as follow:

example image

  • Enable event with Kernel. Select Kernel (on Domain) → Select All Tracepoint Events

    example image

In Control View, information will be displayed in form of a tree structure as follow:

example image

Now you can start the Trace session:

  • Right-click on trace_1 and select Start:

    example image

  • Or click the Start button in the toolbar:

    example image

Then change to Debug session by clicking on top-right button:

example image

The Console will be like this:

example image

Change to the session that are running QEMU by click on below the button:

example image

You should get something like this:

example image

Click on the line Press Enter to continue, and press Enter:

example image

Now back to LTTng Trace sessions and stop Trace

  • By right-click on trace_1 and choose Stop

  • Or click on the Stop button

example image

Export and Import Trace Data to view and analyze

Userspace Trace (UST)

  • Right-click on trace_1 and select Import:

    example image

  • Select the data is created and click Finish:

    example image

  • In Project Explorer, double-click on 64-bit:

    example image

Kernel Trace

Perform data import similar to the UST section. In case you have already imported data, skip this step.

You can also import both Kernel and UST data if you have created both events. For example:

  • In Project Explorer, double-click on kernel:

    example image