Software:ftrace
Developer(s) | Steven Rostedt and others |
---|---|
Initial release | October 9, 2008 |
Operating system | Linux |
Type | Kernel extension |
License | GNU GPL version 2[1] |
Website | www |
ftrace (Function Tracer) is a tracing framework for the Linux kernel. Although its original name, Function Tracer, came from ftrace's ability to record information related to various function calls performed while the kernel is running, ftrace's tracing capabilities cover a much broader range of kernel's internal operations.[2][3]
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 systems and virtualization. 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 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.[2][4][5]:3–11,14,18
An ftrace-enabled Linux kernel is built by enabling the CONFIG_FUNCTION_TRACER kernel configuration option. The entire runtime interaction with ftrace is performed through readable and writable virtual files contained in a specifically mounted debugfs file system; as a result, ftrace requires no specialized userspace utilities to operate.[2][3][6] 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.[2][5]:31–47[7][8]
Internally, ftrace relies on the gcc's profiling mechanism to prepend machine instructions to the compiled 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 to the tracing trampolines, depending on the tracing types and options configured at runtime.[9][10]
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.[11]
See also
- DTrace – a tracing framework for troubleshooting kernel and application problems, originally developed for Solaris
- ktrace – a BSD Unix and Mac OS X utility that traces kernel–program interactions
- ltrace – 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
- ↑ "Linux kernel source: kernel/COPYING file". March 13, 1994. https://www.kernel.org/pub/linux/kernel/COPYING.
- ↑ 2.0 2.1 2.2 2.3 Jake Edge (March 13, 2009). "A look at ftrace". LWN.net. https://lwn.net/Articles/322666/.
- ↑ 3.0 3.1 Steven Rostedt (June 16, 2014). "Linux kernel documentation: Documentation/trace/ftrace.txt". kernel.org. https://www.kernel.org/doc/Documentation/trace/ftrace.txt.
- ↑ "Red Hat Enterprise MRG 2 documentation, Section 3.8. Using the ftrace utility for tracing latencies". Red Hat. May 23, 2014. https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_MRG/2/html/Realtime_Tuning_Guide/sect-Realtime_Tuning_Guide-Realtime_Specific_Tuning-Using_the_ftrace_Utility_for_Tracing_Latencies.html.
- ↑ 5.0 5.1 Steven Rostedt (October 18, 2010). "Ftrace: Linux Kernel Tracing". https://events.linuxfoundation.org/slides/2010/linuxcon_japan/linuxcon_jp2010_rostedt.pdf.
- ↑ "Red Hat Enterprise Linux 6 documentation, Section 6.5. ftrace". Red Hat. March 14, 2014. https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/ftrace.html.
- ↑ Steven Rostedt (October 20, 2010). "trace-cmd: A front-end for Ftrace". LWN.net. https://lwn.net/Articles/410200/.
- ↑ Steven Rostedt (February 2, 2011). "Using KernelShark to analyze the real-time scheduler". LWN.net. https://lwn.net/Articles/425583/.
- ↑ Steven Rostedt (January 5, 2015). "Ftrace Kernel Hooks: More than just tracing". pp. 6–12, 24, 34, 56–58. http://www.linuxplumbersconf.org/2014/ocw/system/presentations/1773/original/ftrace-kernel-hooks-2014.pdf.
- ↑ Tim Bird (November 1, 2012). "Measuring Function Duration with Ftrace". pp. 5–6, 12–14. http://elinux.org/images/d/d6/Measuring-function-duration-with-ftrace.pdf.
- ↑ "Linux kernel 2.6.27, Section 1.7. ftrace, sysprof support". October 9, 2008. http://kernelnewbies.org/Linux_2_6_27#head-27c23aa79ee6da975ef95b4fff381ace1667a264.
External links
- Debugging the kernel using Ftrace – part 1 and part 2, LWN.net, 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
Original source: https://en.wikipedia.org/wiki/Ftrace.
Read more |