Linux Trace Toolkit
Encyclopedia
The Linux Trace Toolkit is a set of tools that is designed to log program execution details from a patched Linux kernel and then perform various analyses on them, using console-based and graphical tools. LTT has been mostly superseded by its successor LTTng
(Linux Trace Toolkit Next Generation).
LTT allows the user to see in-depth information about the processes that were running during the trace period, including when context switches occurred, how long the processes were blocked for, and how much time the processes spent executing vs. how much time the processes were blocked. The data is logged to a text file and various console-based and graphical (GTK+
) tools are provided for interpreting that data.
In order to do data collection, LTT requires a patched Linux kernel. The authors of LTT claim that the performance hit for a patched kernel compared to a regular kernel is minimal; Their testing has reportedly shown that this is less than 2.5% on a "normal use" system (measured using batches of kernel makes) and less than 5% on a file I/O intensive system (measured using batches of tar).
trace 15 foo
This command will cause the LTT tracedaemon to do a trace that lasts for 15 seconds, writing trace data to
The
traceview foo
This command will launch a graphical (GTK+
)
s, interrupt
s, and context switch
es, in a simple graphical way.
The
LTTng
LTTng is a system software package for tracing the Linux kernel. LTTng consists of a kernel patch and a kernel module package. It is used together with*ltt-control, a toolchain to control tracing, and...
(Linux Trace Toolkit Next Generation).
LTT allows the user to see in-depth information about the processes that were running during the trace period, including when context switches occurred, how long the processes were blocked for, and how much time the processes spent executing vs. how much time the processes were blocked. The data is logged to a text file and various console-based and graphical (GTK+
GTK+
GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...
) tools are provided for interpreting that data.
In order to do data collection, LTT requires a patched Linux kernel. The authors of LTT claim that the performance hit for a patched kernel compared to a regular kernel is minimal; Their testing has reportedly shown that this is less than 2.5% on a "normal use" system (measured using batches of kernel makes) and less than 5% on a file I/O intensive system (measured using batches of tar).
Collecting trace data
Starting data collection is as easy as:trace 15 foo
This command will cause the LTT tracedaemon to do a trace that lasts for 15 seconds, writing trace data to
foo.trace
and process information from the /proc
filesystem to foo.proc
.The
trace
command is actually a script which runs the program tracedaemon
with some common options. It is possible to run tracedaemon
directly and in that case, the user can use a number of command-line options to control the data which is collected. For the complete list of options supported by tracedaemon
, see the online manual page for tracedaemon.Viewing the results
Viewing the results of a trace can be accomplished with:traceview foo
This command will launch a graphical (GTK+
GTK+
GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...
)
traceview
tool that will read from foo.trace
and foo.proc
. This tool can show information in various interesting ways, including Event Graph, Process Analysis, and Raw Trace. The Event Graph is perhaps the most interesting view, showing the exact timing of events like page faultPage fault
A page fault is a trap to the software raised by the hardware when a program accesses a page that is mapped in the virtual address space, but not loaded in physical memory. In the typical case the operating system tries to handle the page fault by making the required page accessible at a location...
s, interrupt
Interrupt
In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
s, and context switch
Context switch
A context switch is the computing process of storing and restoring the state of a CPU so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU. The context switch is an essential feature of a multitasking operating system...
es, in a simple graphical way.
The
traceview
command is a wrapper for a program called tracevisualizer
. For the complete list of options supported by tracevisualizer
, see the online manual page for tracevisualizer.