Trace-cmd
   HOME

TheInfoList



OR:

ftrace (Function Tracer) is a
tracing Tracing may refer to: Computer graphics * Image tracing, digital image processing to convert raster graphics into vector graphics * Path tracing, a method of rendering images of three-dimensional scenes such that the global illumination is faithf ...
framework A framework is a generic term commonly referring to an essential supporting structure which other things are built on top of. Framework may refer to: Computing * Application framework, used to implement the structure of an application for an op ...
for the
Linux kernel The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
. Although its original name, Function Tracer, came from ftrace's ability to record information related to various
function call In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Functions may ...
s performed while the kernel is running, ftrace's tracing capabilities cover a much broader range of kernel's internal operations.


Details

With its various tracer plugins, ftrace can be targeted at different static tracepoints, such as scheduling events, interrupts, memory-mapped I/O, CPU power state transitions, and operations related to
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
s and
virtualization In computing, virtualization or virtualisation (sometimes abbreviated v12n, a numeronym) is the act of creating a virtual (rather than actual) version of something at the same abstraction level, including virtual computer hardware platforms, stor ...
. Also, dynamic tracking of kernel function calls is available, optionally restrictable to a subset of functions by using globs, and with the possibility to generate call graphs and provide
stack Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
usage reports. At the same time, ftrace can be used to measure various latencies within the Linux kernel, such as for how long interrupts or preemption are disabled. An ftrace-enabled Linux kernel is built by enabling the kernel configuration option. The entire runtime interaction with ftrace is performed through readable and writable
virtual file In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
s contained in a specifically mounted
debugfs debugfs is a special file system available in the Linux kernel since version 2.6.10-rc3.Linux: DebugFS
, by Jeremy, De ...
file system; as a result, ftrace requires no specialized
userspace A modern computer operating system usually segregates virtual memory into user space and kernel space. Primarily, this separation serves to provide memory protection and hardware protection from malicious or errant software behaviour. Kernel ...
utilities to operate. However, there are additional userspace utilities that provide more advanced features for data recording, analysis and visualization; examples of such utilities are ''trace-cmd'' and ''KernelShark''. Internally, ftrace relies on the gcc's profiling mechanism to prepend machine instructions to the
compile In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
d versions of all source-level kernel functions, which redirect the execution of functions to the ftrace's trampolines and tracer plugins that perform the actual tracing. These " entry point" instructions created by gcc are altered by ftrace when the kernel is booted, and varied later at runtime by ftrace between NOPs and actual
jumps Jumping or leaping is a form of locomotion or movement in which an organism or non-living (e.g., robotic) mechanical system propels itself through the air along a ballistic trajectory. Jumping can be distinguished from running, galloping and o ...
to the tracing trampolines, depending on the tracing types and options configured at runtime. ftrace is developed primarily by Steven Rostedt, and it was merged into the Linux kernel mainline in kernel version 2.6.27, which was released on October 9, 2008.


See also

* DTrace a tracing framework for troubleshooting kernel and application problems, originally developed for Solaris *
ktrace ktrace is a utility included with certain versions of BSD Unix and Mac OS X that traces kernel interaction with a program and dumps it to disk for the purposes of debugging and analysis. Traced kernel operations include system calls, namei tr ...
a BSD Unix and Mac OS X utility that traces kernel–program interactions *
ltrace ltrace is a debugging utility in Linux, used to display the calls a userspace application makes to shared libraries. It does this by hooking into the dynamic loading system, allowing it to insert shims which display the parameters which the appl ...
a Linux debugging utility, displays the calls a userland application makes to shared libraries * strace a debugging utility for Linux and some other Unix-like systems, monitors system calls used by a program and all received signals * SystemTap a scripting language and utility used for instrumenting Linux systems


References


External links


Debugging the kernel using Ftrace part 1
an
part 2
LWN.net LWN.net is a computing webzine with an emphasis on free software and software for Linux and other Unix-like operating systems. It consists of a weekly issue, separate stories which are published most days, and threaded discussion attached to ever ...
, December 2009, by Steven Rostedt
Secrets of the Ftrace function tracer
LWN.net, January 20, 2010, by Steven Rostedt
Ftrace: The hidden light switch
LWN.net, August 13, 2014, by Brendan Gregg
The source of the e1000e corruption bug
LWN.net, October 21, 2008, by Jonathan Corbet {{Operating system Debugging Free software programmed in C Linux kernel features Unix programming tools