Skip to content

Commit

Permalink
Documentation/trace: Correcting and extending tracepoint documentation
Browse files Browse the repository at this point in the history
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: Zoltan Kiss <[email protected]>
Acked-by: Mathieu Desnoyers <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
Zoltan Kiss authored and Jiri Kosina committed Aug 27, 2013
1 parent 59e68a1 commit fd8176e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Documentation/trace/tracepoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,30 @@ Two elements are required for tracepoints :

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>

DECLARE_TRACE(subsys_eventname,
TP_PROTO(int firstarg, struct task_struct *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) :

#include <trace/subsys.h>
#include <trace/events/subsys.h>

#define CREATE_TRACE_POINTS
DEFINE_TRACE(subsys_eventname);

void somefct(void)
Expand All @@ -72,6 +84,9 @@ Where :
- TP_ARGS(firstarg, p) are the parameters names, same as found in the
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
probe (function to call) for the specific tracepoint through
register_trace_subsys_eventname(). Removing a probe is done through
Expand Down

0 comments on commit fd8176e

Please sign in to comment.