提交 fd8176e3 编写于 作者: Z Zoltan Kiss 提交者: Jiri Kosina

Documentation/trace: Correcting and extending tracepoint documentation

The sample missed the moving of the header files into the events subdirectory.
I've also extended it based on the existing headers, and mentioned the tiny
but important role of CREATE_TRACE_POINTS.
Signed-off-by: NZoltan Kiss <zoltan.kiss@citrix.com>
Acked-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 59e68a18
...@@ -40,7 +40,13 @@ Two elements are required for tracepoints : ...@@ -40,7 +40,13 @@ Two elements are required for tracepoints :
In order to use tracepoints, you should include linux/tracepoint.h. In order to use tracepoints, you should include linux/tracepoint.h.
In include/trace/subsys.h : In include/trace/events/subsys.h :
#undef TRACE_SYSTEM
#define TRACE_SYSTEM subsys
#if !defined(_TRACE_SUBSYS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_SUBSYS_H
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
...@@ -48,10 +54,16 @@ DECLARE_TRACE(subsys_eventname, ...@@ -48,10 +54,16 @@ DECLARE_TRACE(subsys_eventname,
TP_PROTO(int firstarg, struct task_struct *p), TP_PROTO(int firstarg, struct task_struct *p),
TP_ARGS(firstarg, p)); TP_ARGS(firstarg, p));
#endif /* _TRACE_SUBSYS_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
In subsys/file.c (where the tracing statement must be added) : In subsys/file.c (where the tracing statement must be added) :
#include <trace/subsys.h> #include <trace/events/subsys.h>
#define CREATE_TRACE_POINTS
DEFINE_TRACE(subsys_eventname); DEFINE_TRACE(subsys_eventname);
void somefct(void) void somefct(void)
...@@ -72,6 +84,9 @@ Where : ...@@ -72,6 +84,9 @@ Where :
- TP_ARGS(firstarg, p) are the parameters names, same as found in the - TP_ARGS(firstarg, p) are the parameters names, same as found in the
prototype. prototype.
- if you use the header in multiple source files, #define CREATE_TRACE_POINTS
should appear only in one source file.
Connecting a function (probe) to a tracepoint is done by providing a Connecting a function (probe) to a tracepoint is done by providing a
probe (function to call) for the specific tracepoint through probe (function to call) for the specific tracepoint through
register_trace_subsys_eventname(). Removing a probe is done through register_trace_subsys_eventname(). Removing a probe is done through
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册