# Getting Started

The LTTng plug-in for Eclipse is used to visualize and analyze kernel traces produced by the LTTng tracer. Controlling the recording and fetching of an LTTng trace from Eclipse is currently a work in progress therefore, currently the plug-in can only be used to visualize existing LTTng traces. To record your own trace, you will need to install the LTTng kernel patches and the LTTv application (refer to the LTTng site for more information on how to record and fetch traces).

If not already installed, you can download and install the LTTng plug-ins from the Eclipse update site (search for LTTng under Linux Tools).

The rest of this section provides instructions on how to complete the LTTng for Eclipse installation and verify that it is correct.

- Installing the LTTng parsing library
- Downloading Sample Traces
- Installation of the LTTng Agent
- Installation Verification

## Installing the LTTng parsing library

If you are using Ubuntu, you might want to use the LTTng PPA and avoid the detailed library installation. See the instalaltion video at http://lttng.org/eclipse for more information.

The LTTng plug-in for Eclipse requires the installation of a third-party library, liblttngtrace, that is used to parse the binary LTTng traces. For the first Eclipse release, it was decided not to re-implemented that library in Java but to simply integrate it using JNI. As a consequence, you need to download, compile and install the parsing library.

This trace parsing library is not delivered as part of Eclipse (licensing stuff) and has to be downloaded from the LTTng site, compiled and then installed on your Linux system.

Currently, the Eclipse plug-in supports the following version of the LTTng trace format: 2.3, 2.5 and 2.6. Depending on which trace version(s) you wish to analyze, you will need to download the appropriate snapshot from the corresponding git repository (pick the "snapshot" link next to the latest commit):

LTTng trace format 2.3 parser
LTTng trace format 2.5 parser
LTTng trace format 2.6 parser

If you wish to stream LTTng traces (format 2.6 only), you will need to install the following library instead:

LTTng trace format 2.6 parser with live trace read

Build and install the snapshot(s) you downloaded. If you wish to install more than one version of the library, you will have to build them in format version sequence (e.g. build 2.6 last). For a plain library installation (in /usr/local/lib), you can execute the following commands for each version you wish to install:

    $ cd liblttngtrace-2.n
    $ ./autogen.sh --with-jni-interface --without-lttv && make
    # make install

You will end up with something like this (the loader acts as a factory to pre-analyze the trace and load the correct parser library):

    $ ls -l1 /usr/local/lib
    total 1048
    -rwxr-xr-x. 1 root root 210300 2010-06-07 11:24 liblttvtraceread-2.5.so
    -rwxr-xr-x. 1 root root 211052 2010-06-07 11:25 liblttvtraceread-2.6.so
    -rw-r--r--. 1 root root 316040 2010-06-07 11:25 liblttvtraceread.a
    -rwxr-xr-x. 1 root root   1175 2010-06-07 11:25 liblttvtraceread.la
    -rwxr-xr-x. 1 root root  93963 2010-06-07 11:24 liblttvtraceread_loader-2.5.so
    -rwxr-xr-x. 1 root root  93963 2010-06-07 11:25 liblttvtraceread_loader-2.6.so
    -rw-r--r--. 1 root root 125442 2010-06-07 11:25 liblttvtraceread_loader.a
    -rwxr-xr-x. 1 root root   1224 2010-06-07 11:25 liblttvtraceread_loader.la
    lrwxrwxrwx. 1 root root     30 2010-06-07 11:25 liblttvtraceread_loader.so -> liblttvtraceread_loader-2.6.so
    lrwxrwxrwx. 1 root root     23 2010-06-07 11:25 liblttvtraceread.so -> liblttvtraceread-2.6.so

A number of configuration options are available to fine tune the library builds:

    $ ./configure -- help
    Usage: ./configure [OPTION]... [VAR=VALUE]...

    To assign environment variables (e.g., CC, CFLAGS...), specify them as
    VAR=VALUE.  See below for descriptions of some of the useful variables.

    Defaults for the options are specified in brackets.

    Configuration:
      -h, --help              display this help and exit
          --help=short        display options specific to this package
          --help=recursive    display the short help of all the included packages
      -V, --version           display version information and exit
      -q, --quiet, --silent   do not print `checking ...' messages
    ...
      <more options>

Once the parsing libraries are installed, it is necessary to let Eclipse know where they sit otherwise the LTTng plugin won't be able to parse the traces. You basically have 3 options at this point:

a) Eclipse.ini

In the eclipse.ini (in the Eclipse folder), add the following line to the VM arguments:

    -Djava.library.path=/usr/local/lib

b) LD_LIBRARY_PATH

Alternatively, you can specify the libraries location using LD_LIBRARY_PATH on the command line/script when you start your Eclipse.

    > LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" ./eclipse

c) Project trace library path

If you are customizing your own LTTng parsing libraries, you might have a number of variants sitting on your system and you might want to have the freedom to dynamically associate a parser to a project. The LTTng plugin allows you to do so (see Project View).

However, in this case, the RUNPATH of the library loader (liblttvtraceread_loader-X.Y.so) needs to be doctored a little so it can find the actual parsing libraries. This is done using the patchelf utility (available from here). Note that the library loader has to reside in the same directory as the parsing library ( make install takes care of that).

    > cd <wherever>
    > patchelf --set-rpath '.:$ORIGIN' liblttvtraceread_loader-X.Y.so

Alternatively, you can tweak the library's makefile and set the RUNPATH directly.

## Downloading Sample Traces

To verify that your installation is functional, you can download sample traces from GitHub. Each trace as its own characteristics and complexity. The size given refers to the size of the trace once "untarred", the actual tar size should be ~10 times smaller. To download a trace: click on the selected trace and then click on the "Downloads" button.

The following LTTng traces are provided as samples:

trace-2.5-15316 (360K) Very small trace (format 2.5 - 15316 events) made from a single LTTng marker. Recorded with a VirtualBox system with 1 processor.

trace-2.5-15471 (365K) Very small trace (format 2.5 - 15471 events) made from a single LTTng marker. Recorded with a VirtualBox system with 1 processor.

trace-2.6-22K (1.1M) Small trace (format 2.6 - 22K events).

(More sample traces to come)

## Installation of the LTTng Agent

The LTTng Eclipse integration supports the LTTng Tracer Toolchain version v0.x and version v.2.0 (or later) for controlling LTTng tracers remotely. For the support of version v0.x an LTTng agent has to be running on the remote system.

To download the source code from the relevant git repository, use git clone git://git.dorsal.polymtl.ca/git/lttng-agent.git from a Linux command shell. Then go to directory lttng-agent/manual in the cloned git repository and type make. This will generate the LTTng Agent Manual in HTML format. Please follow the instructions in this manual for the manual installation of the agent.

To install an agent on Ubuntu using a PPA package follow the instruction of the web site LTTng PPA. However, this version won't always include the latest bugfixes. To get the latest version, the user should download the source code, compile and install the agent manually.

## Installation Verification

Here are the quick steps to verify that your installation is functional. If needed, refer to the LTTng Perspective section for clarifications.

- Start Eclipse
- Open the LTTng perspective
- Create an LTTng project
  - Right-click in the Project view and select "New Project"
  - Enter the name of your project (e.g. "MyLTTngProject")
  - The project will be created. It will contain 2 empty folders: "Traces" and "Experiments"
- Import a sample trace
  - Right-click on the newly created project and select "Import Trace"
  - Navigate to the sample LTTng trace that you want to visualize
  - Note: you have to drill down into the trace directory to import the trace correctly (yes, we know that the Import function needs to be re-written...)
  - The newly imported trace should appear under the Traces folder
- Visualize the trace
  - Expand the Traces folder
  - Double-click on the trace
  - The trace should load and the views be populated

Refer to LTTng Perspective for detailed description of the views and their usage.