User guide for LTTng and Trace Compass with Titan [message #1770720] |
Wed, 16 August 2017 13:07 |
Bence Janos Szabo Messages: 9 Registered: April 2017 |
Junior Member |
|
|
User guide for LTTng and Trace Compass with Titan
Representing LTTng logs generated by TTCN-3 applications compiled and executed with Titan in Trace Compass permits understanding the interactions between the Linux kernel and the applications themselves.
Usage of resources (memory, CPU, file I/O) can be monitored and connected to the executing code, thus permitting the optimization of the code.
- Eclipse Titan installation
For installation from a binary package, please see the Eclipse Titan installation guide packed with binaries. When installing from source, refer to the README.linux file in github:
https://github.com/eclipse/Titan.core
- Installing the LTTng Tracer
On Ubuntu 16.04 the following packages have to be installed:
- lttng-tools
- lttng-modules-dkms
- liblttng-ust0
- liblttng-ust-dev
- Configuring Titan to compile the LTTng logger and logging with the LTTng logger
In the Makefile.personal add the following line:
Then recompile TITAN using:
make distclean && make && make install
It is advised to use the clang 3.8 compiler when compiling the LTTng logger. If the LTTng logger does not compile, then try installing the LTTng tracer from source: http://lttng.org/docs/v2.9/#doc-building-from-source
After the TITAN compilation is finished add the following line to your runtime configuration file to use the LTTng logger:
LoggerPlugins := { LTTngUSTLogger := "liblttng-ust-logger" }
Do not forget to use the dynamic runtime library of TITAN in the Makefile
(TTCN3_LIB = libttcn3-dynamic or TTCN3_LIB = libttcn3-parallel-dynamic).
For more information about TITAN LTTng logger see the TITAN reference guide section 7.2.2.4.
- Configuring the LTTng tracer
To be able to trace kernel events the current user of the operating system must be added to the tracing group (needs root access) from terminal:
sudo usermod -aG tracing username
- To create an lttng tracing session:
- Create a channel with a large buffer size:
sudo lttng enable-channel --kernel chan --subbuf-size=8M
- Add the following events to the tracing session:
sudo lttng enable-event --kernel --channel=chan block_bio_backmerge
sudo lttng enable-event --kernel --channel=chan block_bio_remap
sudo lttng enable-event --kernel --channel=chan block_rq_complete
sudo lttng enable-event --kernel --channel=chan block_rq_issue
sudo lttng enable-event --kernel --channel=chan irq_handler_entry
sudo lttng enable-event --kernel --channel=chan irq_handler_exit
sudo lttng enable-event --kernel --channel=chan irq_softirq_entry
sudo lttng enable-event --kernel --channel=chan irq_softirq_exit
sudo lttng enable-event --kernel --channel=chan irq_softirq_raise
sudo lttng enable-event --kernel --channel=chan kmem_mm_page_alloc
sudo lttng enable-event --kernel --channel=chan kmem_mm_page_free
sudo lttng enable-event --kernel --channel=chan lttng_statedump_block_device
sudo lttng enable-event --kernel --channel=chan lttng_statedump_file_descriptor
sudo lttng enable-event --kernel --channel=chan lttng_statedump_process_state
sudo lttng enable-event --kernel --channel=chan mm_page_alloc
sudo lttng enable-event --kernel --channel=chan mm_page_free
sudo lttng enable-event --kernel --channel=chan net_dev_xmit
sudo lttng enable-event --kernel --channel=chan netif_receive_skb
sudo lttng enable-event --kernel --channel=chan sched_pi_setprio
sudo lttng enable-event --kernel --channel=chan sched_process_exec
sudo lttng enable-event --kernel --channel=chan sched_process_fork
sudo lttng enable-event --kernel --channel=chan sched_switch
sudo lttng enable-event --kernel --channel=chan sched_wakeup
sudo lttng enable-event --kernel --channel=chan sched_waking
sudo lttng enable-event --kernel --channel=chan softirq_entry
sudo lttng enable-event --kernel --channel=chan softirq_exit
sudo lttng enable-event --kernel --channel=chan softirq_raise
sudo lttng enable-event --kernel --channel=chan --syscall all
If callstack information is also needed, this can be added by following the instructions in:
http://archive.eclipse.org/tracecompass/doc/stable/org.eclipse.tracecompass.doc.user/LTTng-UST-Analyses.html#Call_Stack_View
- Add the following event to trace TITAN lttng logs:
sudo lttng enable-event --userspace titan_core:'*'
- Start tracing:
- Execute the program
- Stop tracing:
The lttng tracer will generate log traces in the HOME_DIR/lttng-traces folder by default. To visualize and analyse the traces the Trace Compass tool can be used.
- Installing Trace Compass
Eclipse Trace Compass is an open source application for viewing and analyzing any type of logs or traces. Its' goal is to provide views, graphs, metrics, and more to help extract useful information from these traces.
Trace Compass can be downloaded from the website: http://tracecompass.org/#getting or it can be installed as an eclipse plugin. For instructions see: http://tracecompass.org/download.html
It is advised to install the lttng-analyses scripts too. For installation instructions see: https://github.com/lttng/lttng-analyses
After Trace Compass is installed the traces generated can be imported into the tool and it will visualize it and gives useful information.
- Using Trace Compass
In this section a short user guide will be presented. The full user guide can be found at: http://archive.eclipse.org/tracecompass/doc/stable/org.eclipse.tracecompass.doc.user/User-Guide.html
- Open Trace Compass or Eclipse with installed Trace Compass plugin
- Create a new Tracing project
- After the Tracing project is created select the Traces folder under the Tracing project and select Import after right clicking on the Traces folder.
- An import window pops up and select your tracing folder to import the traces into Trace Compass
- After importing the traces it is possible to select different perspectives and different views which shows different information. The importing and analysis of the traces may take a long time, depending on the size of the log files
- To align different traces and view them together create a new Experiment and right click on the created Experiment and select Select traces option and select the traces which will be viewed together
- Examples
In this view it is possible to see the CPU usage of processes. If a process is selected, then the referring usage is displayed with red lines:
In this view it is possible to see the memory usage of processes in the Kernel Memory Usage view:
In this view it is possible to see the disk I/O activity in the Disk I/O Activity view:
The event statistics can be seen in diagrams. The user can make a selection in the Histogram or in one of the views and it will show the events in the selection:
In this picture the statistics about the system calls can be seen:
The Trace Compass in combination with LTTng logging in Titan can be used to display and detect correlations between the TTCN-3 code execution and Linux resource usage. As such, can be used as an advanced debugging/analysis tool and should be promoted as such, certainly by the Eclipse Titan project, and, if possible, by the Trace Compass project.
|
|
|
Powered by
FUDForum. Page generated in 0.02467 seconds