Skip to content

RFC event tracer

Steven Rostedt lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tracing: add event trace infrastructureinclude/asm-generic/vmlinux.lds.h kernel/trace/Kconfig kernel/trace/Makefile +2 more+349 -13 replies
2/4tracing: add DECLARE_TRACE_FMT to tracepoint.hinclude/linux/tracepoint.h+3 -00 replies
3/4tracing: add schedule events to event traceinclude/trace/sched.h include/trace/sched_event_types.h kernel/trace/Makefile +1 more+89 -480 replies
4/4tracing: make event directory structurekernel/trace/trace_events.c kernel/trace/trace_events.h+137 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4][RFC] event tracer

This is still RFC, do not pull.

This patch set gives the ability to add a format string and args to a trace point declaration. Then it gives a tracer an opportunity to override the header macro and use the default trace format to trace the object.

For example (and used in this patch series), the sched tracepoint declarations are moved from include/trace/sched.h to include/trace/sched_event_types.h, and instead of using the macro DECLARE_TRACE we use DECLARE_TRACE_FMT. The first three arguments are the same, but it adds 2 more arguments. A printf format and arguments.

The new trace/sched.h file contains:

  #include <linux/sched.h>
  #include <linux/tracepoint.h>

  #include <trace/sched_event_types.h>

The sched_event_types.h file has:

DECLARE_TRACE_FMT(sched_kthread_stop,

        TPPROTO(struct task_struct *t),
                  TPARGS(t),
                   "task %s:%d", TPARGS(t->comm, t->pid));

The tracepoint.h defines DECLARE_TRACE_FMT as:

#define DECLARE_TRACE_FMT(name, proto, args, fmt, fmt_args) \
DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))

But in kernel/trace/events.c we have:

/* trace/<type>.h here */
#include <trace/sched.h>

#include "trace_events.h"

/* trace/<type>_event_types.h here */
#include <trace/sched_event_types.h>

The trace_events.h redefines the DECLARE_TRACE_FMT and makes a hook for to automate adding event points.

To add event points, convert to the DECLARE_TRACE_FMT, add your default printf format, and then add to events.c, the <type>.h and <type>_event_types.h as described. Then your trace points will appear in the event tracer.

Next I'll convert the rest of the tracepoints that are already defined to this format.

The following patches are in:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git

branch: rfc/event_tracer

Steven Rostedt (4):
tracing: add event trace infrastructure
tracing: add DECLARE_TRACE_FMT to tracepoint.h
tracing: add schedule events to event trace
tracing: make event directory structure

----

 include/asm-generic/vmlinux.lds.h |   11 +-
 include/linux/tracepoint.h        |    3 +
 include/trace/sched.h             |   49 +-----
 include/trace/sched_event_types.h |   74 +++++++
 kernel/trace/Kconfig              |    9 +
 kernel/trace/Makefile             |    2 +
 kernel/trace/events.c             |   13 ++
 kernel/trace/trace_events.c       |  407 +++++++++++++++++++++++++++++++++++++
 kernel/trace/trace_events.h       |   52 +++++
 9 files changed, 571 insertions(+), 49 deletions(-)