Notes about ftrace
文章目录
建议先阅读下使用 ftrace 来跟踪系统问题 - ftrace 介绍.
1. Introduction
ftrace is an internal tracer designed to help out developers and designers of systems to find what is going on inside the kernel. It can be used for debugging or analyzing latencies and performance issues that take place outside of user-space.
Although ftrace is typically considered the function tracer, it is really a frame work of several assorted tracing utilities. There’s latency tracing to examine what occurs between interrupts disabled and enabled, as well as for preemption and from a time a task is woken to the task is actually scheduled in.
One of the most common uses of ftrace is the event tracing. Through out the kernel is hundreds of static event points that can be enabled via the tracefs file system to see what is going on in certain parts of the kernel.
2. Tracers
2.1 function
1 | cd /sys/kernel/debug/tracing |
2.2 function_graph
1 | cd /sys/kernel/debug/tracing |
2.3 blk
2.4 hwlat
2.5 irqsoff
2.6 preemptoff
2.7 preemptirqsoff
2.8 wakeup
2.9 wakeup_rt
2.10 wakeup_dl
2.11 mmiotrace
2.12 branch
2.13 nop
3. Examples of using the tracer
4. How userspace can interact with ftrace
Debugging the kernel using Ftrace - part 2
Single thread tracing
5. Useful commands and links
1 | sudo cat /sys/kernel/debug/tracing/available_events |