How it works...
A tracepoint is inserted using the TRACE_EVENT macro. It inserts a callback in the kernel source that gets called with the tracepoint parameters as arguments. Tracepoints added with the TRACE_EVENT macro allow ftrace or any other tracer to use them. The callback inserts the trace at the calling tracer's ring buffer.
To insert a new tracepoint into the Linux kernel, define a new header file with a special format. By default, tracepoint kernel files are located in include/trace/events, but the kernel has functionality so that the header files can be located in a different path. This is useful when defining a tracepoint in a kernel module.
To use the tracepoint, the header file must be included in any file that inserts the tracepoint, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access