> For the complete documentation index, see [llms.txt](https://richardweiyang-2.gitbook.io/kernel-exploring/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://richardweiyang-2.gitbook.io/kernel-exploring/00-index-2.md).

# Trace/Profie/Debug

随着对内核理解的深入，是时候了解一下对内核调试、跟踪、画像的技术了。

不仅可以帮助自己了解内核运行，更能在出现性能问题时定位瓶颈。

在内核中能帮助我们的工具有很多，让我一一学来。

经过一段时间学习，发现内核中很多探测方法都基于了ftrace提供的框架。比如在[ftrace 中 eventtracing 的实现原理](https://www.ibm.com/developerworks/cn/linux/1609_houp_ftrace/index.html)中提到的trace原理，以及其他探测机制是如何使用ftrace框架的。在这里也把文中的图放在这里，做一个直观的了解。

![ftrace framework](/files/-M6kt6R-Zp9tRcX3HV1B)

既然如此，那我们就先来看看ftrace的使用以及原理。

[ftrace的使用](/kernel-exploring/00-index-2/03-ftrace_usage.md)

[探秘ftrace](/kernel-exploring/00-index-2/04-ftrace_internal.md)

了解了原理后，我们来看看都有哪些工具会依赖ftrace。

比如 [内核热补丁的黑科技](/kernel-exploring/00-index-2/05-kernel_live_patch.md)。这个看上去不像是trace的工具，却依赖ftrace框架来实现的。

还有一个借用了部分ftrace框架，但是实际上是另一个机制的[Trace Event](/kernel-exploring/00-index-2/02-trace_event.md)

接着来看的是传说为瑞士军刀的[eBPF初探](/kernel-exploring/00-index-2/01-ebpf.md). 严重怀疑后续可能要完整的一章来讲述清楚。

对eBPF的探索中，发现他和内核系统中其他的探测机制有着非常深厚的关联。

比如:

[TraceEvent](/kernel-exploring/00-index-2/02-trace_event.md)
