enhancements for tracing in tip
Subsystems (2)
Steven Rostedt
maintainerIngo,
This patch series replaces the TRACE_EVENT_FORMAT with the new TRACE_EVENT
NOTE: I started with a pull from tip/tracing/printk. It does not show up as a merge since I did the pull at the point where it forked. But by pulling this branch, you will also receive your changes from tracing/printk. I rebased my changes off of this pull so that my changes would be after the pull, making this patch series cleaner.
Please pull the latest tip/tracing/ftrace tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/ftrace
Steven Rostedt (7):
tracing: typecast sizeof and offsetof to unsigned int
tracing: replace TP<var> with TP_<var>
tracing: use generic __stringify
tracing: new format for specialized trace points
tracing: convert the sched trace points to the TRACE_EVENT macros
tracing: convert irq trace points to new macros
tracing: remove obsolete TRACE_EVENT_FORMAT macro
----
Documentation/tracepoints.txt | 8 +- include/linux/tracepoint.h | 10 +- include/trace/block.h | 70 +++--- include/trace/irq_event_types.h | 46 ++-- include/trace/lockdep_event_types.h | 26 +- include/trace/power.h | 12 +- include/trace/sched_event_types.h | 442 +++++++++++++++++++++++--------- include/trace/workqueue.h | 16 +- kernel/trace/events.c | 4 +- kernel/trace/trace.h | 5 - kernel/trace/trace_event_types.h | 29 +- kernel/trace/trace_events.c | 174 +------------ kernel/trace/trace_events_stage_1.h | 27 +- kernel/trace/trace_events_stage_2.h | 91 +++++-- kernel/trace/trace_events_stage_3.h | 42 +--- kernel/trace/trace_export.c | 41 +++- kernel/trace/trace_format.h | 55 ---- kernel/trace/trace_selftest.c | 6 +- samples/tracepoints/tp-samples-trace.h | 8 +- 19 files changed, 575 insertions(+), 537 deletions(-)
Steven Rostedt
maintainerPATCH 1/7 tracing: typecast sizeof and offsetof to unsigned int
From: Steven Rostedt <[email protected]>
Impact: fix compiler warnings
On x86_64 sizeof and offsetof are treated as long, where as on x86_32 they are int. This patch typecasts them to unsigned int to avoid one arch giving warnings while the other does not.
--- kernel/trace/trace_events.c | 15 ++++++++------- kernel/trace/trace_export.c | 10 +++++----- kernel/trace/trace_format.h | 12 ++++++------ 3 files changed, 19 insertions(+), 18 deletions(-)
kernel/trace/trace_events.c +8 -7
@@ -448,8 +448,9 @@ event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt, }#undef FIELD -#define FIELD (type, name) \ - #type, #name, offsetof(typeof(field), name), sizeof(field.name) +#define FIELD (type, name) \ + #type, #name, (unsigned int)offsetof(typeof(field), name), \ + (unsigned int)sizeof(field.name)static int trace_write_header (struct trace_seq *s) {
@@ -457,11 +458,11 @@ static int trace_write_header(struct trace_seq *s)/* struct trace_entry */ return trace_seq_printf(s, - "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" - "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" - "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" - "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" - "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" + "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" + "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" + "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" + "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" + "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\n", FIELD(unsigned char, type), FIELD(unsigned char, flags),
kernel/trace/trace_export.c +5 -5
@@ -18,11 +18,11 @@#include "trace_format.h" #undef TRACE_FIELD_ZERO_CHAR -#define TRACE_FIELD_ZERO_CHAR (item) \ - ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \ - "offset:%lu;\tsize:0;\n", \ - offsetof(typeof(field), item)); \ - if (!ret) \ +#define TRACE_FIELD_ZERO_CHAR (item) \ + ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \ + "offset:%u;\tsize:0;\n", \ + (unsigned int)offsetof(typeof(field), item)); \ + if (!ret) \ return 0;
kernel/trace/trace_format.h +6 -6
@@ -22,9 +22,9 @@#undef TRACE_FIELD#define TRACE_FIELD (type, item, assign) \ ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ - "offset:%lu;\tsize:%lu;\n", \ - offsetof(typeof(field), item), \ - sizeof(field.item)); \ + "offset:%u;\tsize:%u;\n", \ + (unsigned int)offsetof(typeof(field), item), \ + (unsigned int)sizeof(field.item)); \ if (!ret) \ return 0;
@@ -32,9 +32,9 @@#undef TRACE_FIELD_SPECIAL#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \ - "offset:%lu;\tsize:%lu;\n", \ - offsetof(typeof(field), item), \ - sizeof(field.item)); \ + "offset:%u;\tsize:%u;\n", \ + (unsigned int)offsetof(typeof(field), item), \ + (unsigned int)sizeof(field.item)); \ if (!ret) \ return 0;
Signature · 3 lines
1.6.1.3 --
Re: [PATCH 1/7] tracing: typecast sizeof and offsetof to unsigned int
Quoted 3 lines · On Tue, 10 Mar 2009 00:57:11 -0400 Steven Rostedt <[email protected]> wrote:
On
x86_64sizeof and offsetof are treated as long, where as onx86_32they are int. This patch typecasts them to unsigned int to avoid one arch giving warnings while the other does not.
Actually, both have type size_t.
Quoted 6 lines
static int
trace_write_header(struct trace_seq *s){kernel/trace/trace_events.c +0
-0@@ -457,11 +458,11 @@ static int trace_write_header(struct trace_seq *s)/* struct trace_entry */ return trace_seq_printf(s,
kernel/trace/trace_events.c static int trace_write_header(struct trace_seq *s) · line 465
Quoted 10 lines
kernel/trace/trace_events.c +5
-5-"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
Which may be printed with %z.
Steven Rostedt
maintainerRe: [PATCH 1/7] tracing: typecast sizeof and offsetof to unsigned int
Quoted 12 lines · Andrew Morton
Quoted 3 lines · On Tue, 10 Mar 2009 00:57:11 -0400 Steven Rostedt <[email protected]> wrote:
On
x86_64sizeof and offsetof are treated as long, where as onx86_32they are int. This patch typecasts them to unsigned int to avoid one arch giving warnings while the other does not.Actually, both have type
size_t.Quoted 4 lines
static int
trace_write_header(struct trace_seq *s){(quoted diff) +0
-0@@ -457,11 +458,11 @@ static int trace_write_header(struct trace_seq *s)
Quoted 14 lines
kernel/trace/trace_events.c static int trace_write_header(struct trace_seq *s) · line 465
Quoted 12 lines
kernel/trace/trace_events.c +5
-5/* struct trace_entry */ return trace_seq_printf (s, -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" -"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" - "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" +"\tfield:%s %s;\toffset:%u;\tsize:%u;\n" + "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"Which may be printed with %z.
That's new to me ;-)
OK, I'll add a patch to my next series.
Thanks,
-- Steve
Steven Rostedt
maintainerPATCH 2/7 tracing: replace TP<var> with TP_<var>
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: clean up
The macros TPPROTO, TPARGS, TPFMT, TPRAWFMT, and TPCMD all look a bit ugly. This patch adds an underscore to their names.
--- Documentation/tracepoints.txt | 8 +- include/linux/tracepoint.h | 6 +- include/trace/block.h | 70 +++++++++++----------- include/trace/irq_event_types.h | 16 +++--- include/trace/lockdep_event_types.h | 24 ++++---- include/trace/power.h | 12 ++-- include/trace/sched_event_types.h | 98 ++++++++++++++++---------------- include/trace/workqueue.h | 16 +++--- kernel/trace/trace_event_types.h | 28 +++++----- kernel/trace/trace_events_stage_2.h | 6 +- kernel/trace/trace_events_stage_3.h | 8 +- kernel/trace/trace_export.c | 8 +- kernel/trace/trace_format.h | 55 ------------------ samples/tracepoints/tp-samples-trace.h | 8 +- 14 files changed, 154 insertions(+), 209 deletions(-) delete mode 100644 kernel/trace/trace_format.h
Documentation/tracepoints.txt +4 -4
@@ -45,8 +45,8 @@ In include/trace/subsys.h : #include <linux/tracepoint.h> DECLARE_TRACE(subsys_eventname, - TPPROTO(int firstarg, struct task_struct *p), - TPARGS(firstarg, p)); + TP_PROTO(int firstarg, struct task_struct *p), + TP_ARGS(firstarg, p)); In subsys/file.c (where the tracing statement must be added) :
@@ -66,10 +66,10 @@ Where : - subsys is the name of your subsystem. - eventname is the name of the event to trace. -- TPPROTO(int firstarg, struct task_struct *p) is the prototype of the +- TP_PROTO(int firstarg, struct task_struct *p) is the prototype of the function called by this tracepoint. -- TPARGS(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. Connecting a function (probe) to a tracepoint is done by providing a
include/linux/tracepoint.h +3 -3
@@ -31,8 +31,8 @@ struct tracepoint {* Keep in sync with vmlinux.lds.h. */ -#define TPPROTO(args...) args -#define TPARGS(args...) args +#define TP_PROTO(args...) args +#define TP_ARGS(args...) args#ifdef CONFIG_TRACEPOINTS
@@ -65,7 +65,7 @@ struct tracepoint { { \ if (unlikely(__tracepoint_##name.state)) \ __DO_TRACE(&__tracepoint_##name, \ - TPPROTO(proto), TPARGS(args)); \ + TP_PROTO(proto), TP_ARGS(args)); \ } \ static inline int register_trace_##name(void (*probe)(proto)) \ { \
include/trace/block.h +35 -35
107 lines not on this page · raw message
include/trace/irq_event_types.h +8 -8
@@ -9,25 +9,25 @@#define TRACE_SYSTEM irqTRACE_EVENT_FORMAT (irq_handler_entry, - TPPROTO(int irq, struct irqaction *action), -TPARGS (irq, action), -TPFMT ("irq=%d handler=%s" , irq, action->name), + TP_PROTO(int irq, struct irqaction *action), +TP_ARGS (irq, action), +TP_FMT ("irq=%d handler=%s" , irq, action->name),TRACE_STRUCT (TRACE_FIELD (int, irq, irq) ), -TPRAWFMT ("irq %d" ) +TP_RAW_FMT ("irq %d" ) );TRACE_EVENT_FORMAT (irq_handler_exit, - TPPROTO(int irq, struct irqaction *action, int ret), -TPARGS (irq, action, ret), -TPFMT ("irq=%d handler=%s return=%s" , + TP_PROTO(int irq, struct irqaction *action, int ret), +TP_ARGS (irq, action, ret), +TP_FMT ("irq=%d handler=%s return=%s" , irq, action->name, ret ?"handled" :"unhandled" ),TRACE_STRUCT ( TRACE_FIELD(int, irq, irq)TRACE_FIELD (int, ret, ret) ), -TPRAWFMT ("irq %d ret %d" ) +TP_RAW_FMT ("irq %d ret %d" ) );#undef TRACE_SYSTEM
include/trace/lockdep_event_types.h +12 -12
@@ -10,32 +10,32 @@#ifdef CONFIG_LOCKDEP TRACE_FORMAT (lock_acquire, - TPPROTO(struct lockdep_map *lock, unsigned int subclass, + TP_PROTO(struct lockdep_map *lock, unsigned int subclass, int trylock, int read, int check, struct lockdep_map *next_lock, unsigned long ip), -TPARGS (lock, subclass, trylock, read, check, next_lock, ip), -TPFMT ("%s%s%s" , trylock ?"try " :"" , +TP_ARGS (lock, subclass, trylock, read, check, next_lock, ip), +TP_FMT ("%s%s%s" , trylock ?"try " :"" , read ?"read " :"" , lock->name) );TRACE_FORMAT (lock_release, - TPPROTO(struct lockdep_map *lock, int nested, unsigned long ip), -TPARGS (lock, nested, ip), -TPFMT ("%s" , lock->name) + TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), +TP_ARGS (lock, nested, ip), +TP_FMT ("%s" , lock->name) );#ifdef CONFIG_LOCK_STAT TRACE_FORMAT (lock_contended, - TPPROTO(struct lockdep_map *lock, unsigned long ip), -TPARGS (lock, ip), -TPFMT ("%s" , lock->name) + TP_PROTO(struct lockdep_map *lock, unsigned long ip), +TP_ARGS (lock, ip), +TP_FMT ("%s" , lock->name) );TRACE_FORMAT (lock_acquired, - TPPROTO(struct lockdep_map *lock, unsigned long ip), -TPARGS (lock, ip), -TPFMT ("%s" , lock->name) + TP_PROTO(struct lockdep_map *lock, unsigned long ip), +TP_ARGS (lock, ip), +TP_FMT ("%s" , lock->name) );#endif
include/trace/power.h +6 -6
@@ -18,15 +18,15 @@ struct power_trace { };DECLARE_TRACE (power_start, - TPPROTO(struct power_trace *it, unsigned int type, unsigned int state), -TPARGS (it, type, state)); + TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), +TP_ARGS (it, type, state));DECLARE_TRACE (power_mark, - TPPROTO(struct power_trace *it, unsigned int type, unsigned int state), -TPARGS (it, type, state)); + TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), +TP_ARGS (it, type, state));DECLARE_TRACE (power_end, - TPPROTO(struct power_trace *it), -TPARGS (it)); + TP_PROTO(struct power_trace *it), +TP_ARGS (it));#endif /* _TRACE_POWER_H */
include/trace/sched_event_types.h +49 -49
192 lines not on this page · raw message
include/trace/workqueue.h +8 -8
@@ -6,20 +6,20 @@#include <linux/sched.h> DECLARE_TRACE (workqueue_insertion, - TPPROTO(struct task_struct *wq_thread, struct work_struct *work), -TPARGS (wq_thread, work)); + TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), +TP_ARGS (wq_thread, work));DECLARE_TRACE (workqueue_execution, - TPPROTO(struct task_struct *wq_thread, struct work_struct *work), -TPARGS (wq_thread, work)); + TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), +TP_ARGS (wq_thread, work));/* Trace the creation of one workqueue thread on a cpu */ DECLARE_TRACE (workqueue_creation, - TPPROTO(struct task_struct *wq_thread, int cpu), -TPARGS (wq_thread, cpu)); + TP_PROTO(struct task_struct *wq_thread, int cpu), +TP_ARGS (wq_thread, cpu));DECLARE_TRACE (workqueue_destruction, - TPPROTO(struct task_struct *wq_thread), -TPARGS (wq_thread)); + TP_PROTO(struct task_struct *wq_thread), +TP_ARGS (wq_thread));#endif /* __TRACE_WORKQUEUE_H */
kernel/trace/trace_event_types.h +14 -14
@@ -10,7 +10,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore, TRACE_FIELD(unsigned long, ip, ip) TRACE_FIELD(unsigned long, parent_ip, parent_ip) ), -TPRAWFMT (" %lx <-- %lx" ) +TP_RAW_FMT (" %lx <-- %lx" ) ); TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
@@ -19,7 +19,7 @@ TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT, TRACE_FIELD(unsigned long, graph_ent.func, func)TRACE_FIELD (int, graph_ent.depth, depth) ), -TPRAWFMT ("--> %lx (%d)" ) +TP_RAW_FMT ("--> %lx (%d)" ) ); TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
@@ -28,7 +28,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET, TRACE_FIELD(unsigned long, ret.func, func)TRACE_FIELD (int, ret.depth, depth) ), -TPRAWFMT ("<-- %lx (%d)" ) +TP_RAW_FMT ("<-- %lx (%d)" ) ); TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
@@ -41,7 +41,7 @@ TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore, TRACE_FIELD(unsigned char, next_state, next_state) TRACE_FIELD(unsigned int, next_cpu, next_cpu) ), -TPRAWFMT ("%u:%u:%u ==+ %u:%u:%u [%03u]" ) +TP_RAW_FMT ("%u:%u:%u ==+ %u:%u:%u [%03u]" ) ); TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore,
@@ -54,7 +54,7 @@ TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore, TRACE_FIELD(unsigned char, next_state, next_state) TRACE_FIELD(unsigned int, next_cpu, next_cpu) ), -TPRAWFMT ("%u:%u:%u ==+ %u:%u:%u [%03u]" ) +TP_RAW_FMT ("%u:%u:%u ==+ %u:%u:%u [%03u]" ) ); TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore,
@@ -63,7 +63,7 @@ TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore, TRACE_FIELD(unsigned long, arg2, arg2) TRACE_FIELD(unsigned long, arg3, arg3) ), -TPRAWFMT ("(%08lx) (%08lx) (%08lx)" ) +TP_RAW_FMT ("(%08lx) (%08lx) (%08lx)" ) );/*
@@ -83,7 +83,7 @@ TRACE_EVENT_FORMAT(kernel_stack, TRACE_STACK, stack_entry, ignore, TRACE_FIELD(unsigned long, caller[6], stack6) TRACE_FIELD(unsigned long, caller[7], stack7) ), -TPRAWFMT ("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" +TP_RAW_FMT ("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" ) );
@@ -98,7 +98,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore, TRACE_FIELD(unsigned long, caller[6], stack6) TRACE_FIELD(unsigned long, caller[7], stack7) ), -TPRAWFMT ("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" +TP_RAW_FMT ("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" ) );
@@ -108,7 +108,7 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore, TRACE_FIELD(unsigned int, depth, depth)TRACE_FIELD_ZERO_CHAR (buf) ), -TPRAWFMT ("%08lx (%d) %s" ) +TP_RAW_FMT ("%08lx (%d) %s" ) ); TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
@@ -118,7 +118,7 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore, TRACE_FIELD_SPECIAL(char file[TRACE_FUNC_SIZE+1], file, file) TRACE_FIELD(char, correct, correct) ), - TPRAWFMT("%u:%s:%s (%u)") + TP_RAW_FMT("%u:%s:%s (%u)") ); TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
@@ -126,7 +126,7 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore, TRACE_FIELD(u64, from, from)TRACE_FIELD (u64, to, to) ), -TPRAWFMT ("from: %llx to: %llx" ) +TP_RAW_FMT ("from: %llx to: %llx" ) ); TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
@@ -136,7 +136,7 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore, TRACE_FIELD(int, state_data.type, type)TRACE_FIELD (int, state_data.state, state) ), -TPRAWFMT ("%llx->%llx type:%u state:%u" ) +TP_RAW_FMT ("%llx->%llx type:%u state:%u" ) ); TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
@@ -149,7 +149,7 @@ TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore, TRACE_FIELD(gfp_t, gfp_flags, gfp_flags)TRACE_FIELD (int, node, node) ), -TPRAWFMT ("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu" +TP_RAW_FMT ("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu" " flags:%x node:%d" ) );
@@ -159,7 +159,7 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore, TRACE_FIELD(unsigned long, call_site, call_site) TRACE_FIELD(const void *, ptr, ptr) ), -TPRAWFMT ("type:%u call_site:%lx ptr:%p" ) +TP_RAW_FMT ("type:%u call_site:%lx ptr:%p" ) );#undef TRACE_SYSTEM
kernel/trace/trace_events_stage_2.h +3 -3
@@ -20,7 +20,7 @@* * field = (typeof(field))entry; * -* ret = trace_seq_printf(s, <TPRAWFMT> "%s", <ARGS> "\n"); +* ret = trace_seq_printf(s, <TP_RAW_FMT> "%s", <ARGS> "\n"); * if (!ret) * return TRACE_TYPE_PARTIAL_LINE; *
@@ -44,8 +44,8 @@ field->item, -#undef TPRAWFMT -#define TPRAWFMT(args...) args +#undef TP_RAW_FMT +#define TP_RAW_FMT(args...) args#undef TRACE_EVENT_FORMAT#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, tpfmt) \
kernel/trace/trace_events_stage_3.h +4 -4
@@ -106,8 +106,8 @@* */ -#undef TPFMT -#define TPFMT(fmt, args...) fmt "\n", ##args +#undef TP_FMT +#define TP_FMT(fmt, args...) fmt "\n", ##args#define _TRACE_FORMAT (call, proto, args, fmt) \ static void ftrace_event_##call(proto) \
@@ -152,8 +152,8 @@ __attribute__((section("_ftrace_events"))) event_##call = { \#define TRACE_FIELD (type, item, assign)\ entry->item = assign; -#undef TPCMD -#define TPCMD(cmd...) cmd +#undef TP_CMD +#define TP_CMD(cmd...) cmd#undef TRACE_ENTRY#define TRACE_ENTRY entry
kernel/trace/trace_export.c +4 -4
@@ -26,8 +26,8 @@return 0 ; -#undef TPRAWFMT -#define TPRAWFMT(args...) args +#undef TP_RAW_FMT +#define TP_RAW_FMT(args...) args#undef TRACE_EVENT_FORMAT#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, tpfmt) \
@@ -57,8 +57,8 @@ ftrace_format_##call(struct trace_seq *s) \#define TRACE_FIELD (type, item, assign)\ entry->item = assign; -#undef TPCMD -#define TPCMD(cmd...) cmd +#undef TP_CMD +#define TP_CMD(cmd...) cmd#undef TRACE_ENTRY#define TRACE_ENTRY entry
kernel/trace/trace_format.h deleted +0 -55
55 lines not on this page · raw message
samples/tracepoints/tp-samples-trace.h +4 -4
@@ -5,9 +5,9 @@#include <linux/tracepoint.h> DECLARE_TRACE (subsys_event, - TPPROTO(struct inode *inode, struct file *file), -TPARGS (inode, file)); + TP_PROTO(struct inode *inode, struct file *file), +TP_ARGS (inode, file));DECLARE_TRACE (subsys_eventb, -TPPROTO (void), -TPARGS ()); +TP_PROTO (void), +TP_ARGS ());#endif
Signature · 3 lines
1.6.1.3 --
Re: [PATCH 2/7] tracing: replace TP<var> with TP_<var>
Quoted 6 lines · Steven Rostedt
From: Steven Rostedt <[email protected]>
Impact: clean up
The macros TPPROTO, TPARGS, TPFMT, TPRAWFMT, and TPCMD all look a bit ugly. This patch adds an underscore to their names.
Honestly I think they still look ugly.
Documentation/tracepoints.txt In include/trace/subsys.h : · line 49
Quoted 5 lines
DECLARE_TRACE(subsys_eventname,
Documentation/tracepoints.txt +2
-2- TPPROTO(int firstarg, struct task_struct *p), - TPARGS(firstarg, p)); + TP_PROTO(int firstarg, struct task_struct *p), + TP_ARGS(firstarg, p));
Compare that to a
DECLARE_TRACE(subsys_eventname,
trace_proto(int firstarg, struct task_struct *p), trace_args(firstarg, p));
or even when you insist on UPPERCASE:
DECLARE_TRACE(subsys_eventname,
TRACE_PROTO(int firstarg, struct task_struct *p), TRACE_ARGS(firstarg, p));
Steven Rostedt
maintainerRe: [PATCH 2/7] tracing: replace TP<var> with TP_<var>
Quoted 19 lines · Christoph Hellwig
Quoted 6 lines · Steven Rostedt
From: Steven Rostedt <[email protected]>
Impact: clean up
The macros TPPROTO, TPARGS, TPFMT, TPRAWFMT, and TPCMD all look a bit ugly. This patch adds an underscore to their names.
Honestly I think they still look ugly.
Documentation/tracepoints.txt In include/trace/subsys.h : · line 49
Quoted 5 lines
DECLARE_TRACE(subsys_eventname,
Documentation/tracepoints.txt +2
-2- TPPROTO(int firstarg, struct task_struct *p), - TPARGS(firstarg, p)); + TP_PROTO(int firstarg, struct task_struct *p), + TP_ARGS(firstarg, p));Compare that to a
DECLARE_TRACE(subsys_eventname,
Quoted 8 lines
trace_proto(int firstarg, struct task_struct *p), trace_args(firstarg, p));or even when you insist on UPPERCASE:
DECLARE_TRACE(subsys_eventname,
TRACE_PROTO(int firstarg, struct task_struct *p), TRACE_ARGS(firstarg, p));
I have no attachement to the name. I can switch it to TRACE_PROTO etc.
Thanks,
-- Steve
Steven Rostedt
maintainerPATCH 3/7 tracing: use generic __stringify
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: clean up
This removes the custom made STR(x) macros in the tracer and uses the generic __stringify macro instead.
--- kernel/trace/events.c | 4 +--- kernel/trace/trace_events_stage_3.h | 4 ++-- kernel/trace/trace_selftest.c | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-)
kernel/trace/events.c +1 -3
@@ -2,9 +2,7 @@* This is the place to register all trace points as events. */ -/* someday this needs to go in a generic header */ -#define __STR (x) #x -#define STR (x) __STR(x) +#include <linux/stringify.h> #include <trace/trace_events.h>
kernel/trace/trace_events_stage_3.h +2 -2
@@ -139,7 +139,7 @@ static struct ftrace_event_call __used \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_events"))) event_##call = { \ .name = #call, \ - .system = STR(TRACE_SYSTEM), \ + .system = __stringify(TRACE_SYSTEM), \ .regfunc = ftrace_reg_event_##call, \ .unregfunc = ftrace_unreg_event_##call, \ }
@@ -225,7 +225,7 @@ static struct ftrace_event_call __used \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_events"))) event_##call = { \ .name = #call, \ - .system = STR(TRACE_SYSTEM), \ + .system = __stringify(TRACE_SYSTEM), \ .regfunc = ftrace_reg_event_##call, \ .unregfunc = ftrace_unreg_event_##call, \ .raw_init = ftrace_raw_init_event_##call, \
kernel/trace/trace_selftest.c +2 -4
@@ -1,5 +1,6 @@/* Include in trace.c */ +#include <linux/stringify.h> #include <linux/kthread.h> #include <linux/delay.h>
@@ -100,9 +101,6 @@ static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret)#ifdef CONFIG_DYNAMIC_FTRACE -#define __STR (x) #x -#define STR (x) __STR(x) -/* Test dynamic code modification and ftrace filters */ int trace_selftest_startup_dynamic_tracing(struct tracer *trace, struct trace_array *tr,
@@ -130,7 +128,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,* start of the function names. We simply put a '*' to * accommodate them. */ - func_name ="*" STR (DYN_FTRACE_TEST_NAME ); + func_name ="*" __stringify(DYN_FTRACE_TEST_NAME );/* filter only on our function */ ftrace_set_filter (func_name,strlen (func_name),1 );
Signature · 3 lines
1.6.1.3 --
Re: [PATCH 3/7] tracing: use generic __stringify
Quoted 9 lines · Steven Rostedt
From: Steven Rostedt <[email protected]>
Impact: clean up
This removes the custom made STR(x) macros in the tracer and uses the generic
__stringifymacro instead.Signed-off-by Steven Rostedt <[email protected]>---
Hi,
Why not simply use the # ?
Frederic.
Quoted 76 lines
kernel/trace/events.c | 4 +--- kernel/trace/trace_events_stage_3.h | 4 ++-- kernel/trace/trace_selftest.c | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-)kernel/trace/events.c +1
-3@@ -2,9 +2,7 @@* This is the place to register all trace points as events. */ -/* someday this needs to go in a generic header */ -#define __STR (x) #x -#define STR (x) __STR(x) +#include <linux/stringify.h> #include <trace/trace_events.h> kernel/trace/trace_events_stage_3.h +2
-2@@ -139,7 +139,7 @@ static struct ftrace_event_call __used \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_events"))) event_##call = { \ .name = #call, \ - .system = STR(TRACE_SYSTEM), \ + .system = __stringify(TRACE_SYSTEM), \ .regfunc = ftrace_reg_event_##call, \ .unregfunc = ftrace_unreg_event_##call, \ }@@ -225,7 +225,7 @@ static struct ftrace_event_call __used \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_events"))) event_##call = { \ .name = #call, \ - .system = STR(TRACE_SYSTEM), \ + .system = __stringify(TRACE_SYSTEM), \ .regfunc = ftrace_reg_event_##call, \ .unregfunc = ftrace_unreg_event_##call, \ .raw_init = ftrace_raw_init_event_##call, \kernel/trace/trace_selftest.c +2
-4@@ -1,5 +1,6 @@/* Include in trace.c */ +#include <linux/stringify.h> #include <linux/kthread.h> #include <linux/delay.h> @@ -100,9 +101,6 @@ static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret)#ifdef CONFIG_DYNAMIC_FTRACE -#define __STR (x) #x -#define STR (x) __STR(x) -/* Test dynamic code modification and ftrace filters */ int trace_selftest_startup_dynamic_tracing(struct tracer *trace, struct trace_array *tr,@@ -130,7 +128,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,* start of the function names. We simply put a '*' to * accommodate them. */ - func_name ="*" STR (DYN_FTRACE_TEST_NAME ); + func_name ="*" __stringify(DYN_FTRACE_TEST_NAME );/* filter only on our function */ ftrace_set_filter (func_name,strlen (func_name),1 );Signature · 3 lines
1.6.1.3 --
Re: [PATCH 3/7] tracing: use generic __stringify
2009/3/10 Frederic Weisbecker <[email protected]>:
Quoted 12 lines · Steven Rostedt
Quoted 9 lines
From: Steven Rostedt <[email protected]>
Impact: clean up
This removes the custom made STR(x) macros in the tracer and uses the generic
__stringifymacro instead.Signed-off-by Steven Rostedt <[email protected]>---
Quoted 5 lines
Hi,
Why not simply use the # ?
Frederic.
see following url's xstr macro description.
http://gcc.gnu.org/onlinedocs/gcc-4.3.3/cpp/Stringification.html#Stringification
Re: [PATCH 3/7] tracing: use generic __stringify
In reply to Frederic WeisbeckerQuoted 9 lines · Frederic Weisbecker
Quoted 2 lines · Steven Rostedt
This removes the custom made STR(x) macros in the tracer and uses the generic
__stringifymacro instead.Why not simply use the # ?
Review
Quoted 2 lines
(quoted diff) +0
-2-#define __STR(x) #x -#define STR(x) __STR(x)
#include <stdio.h>
#define FOO bar
#define __STR(x) #x
#define STR(x) __STR(x)
void main(void)
{
printf("%s %s\n", __STR(FOO), STR(FOO));
}$ gcc -o str str.c; ./str str.c: In function ‘main’: str.c:9: warning: return type of ‘main’ is not ‘int’ FOO bar
Re: [PATCH 3/7] tracing: use generic __stringify
2009/3/10 Peter Zijlstra <[email protected]>:
Quoted 23 lines · Frederic Weisbecker
Quoted 9 lines · Steven Rostedt
Quoted 3 lines
This removes the custom made STR(x) macros in the tracer and uses the generic
__stringifymacro instead.Why not simply use the # ?
Review
Quoted 2 lines
(quoted diff) +0
-2-#define __STR(x) #x -#define STR(x) __STR(x)#include <
stdio.h>#define FOO bar
#define
__STR(x)#x
#define STR(x)__STR(x)void main(void)
{
printf("%s %s\n",__STR(FOO), STR(FOO));
}
Quoted 4 lines
$ gcc -o str str.c; ./str str.c: In function ‘main’: str.c:9: warning: return type of ‘main’ is not ‘int’ FOO bar
Thank you both for the explanation.
Steven Rostedt
maintainerPATCH 4/7 tracing: new format for specialized trace points
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: clean up and enhancement
The TRACE_EVENT_FORMAT macro looks quite ugly and is limited in its ability to save data as well as to print the record out. Working with Ingo Molnar, we came up with a new format that is much more pleasing to the eye of C developers. This new macro is more C style than the old macro, and is more obvious to what it does.
Here's the example. The only updated macro in this patch is the sched_switch trace point.
The old method looked like this:
TRACE_EVENT_FORMAT(sched_switch,
TP_PROTO(struct rq *rq, struct task_struct *prev,
struct task_struct *next),
TP_ARGS(rq, prev, next),
TP_FMT("task %s:%d ==> %s:%d",
prev->comm, prev->pid, next->comm, next->pid),
TRACE_STRUCT(
TRACE_FIELD(pid_t, prev_pid, prev->pid)
TRACE_FIELD(int, prev_prio, prev->prio)
TRACE_FIELD_SPECIAL(char next_comm[TASK_COMM_LEN],
next_comm,
TP_CMD(memcpy(TRACE_ENTRY->next_comm,
next->comm,
TASK_COMM_LEN)))
TRACE_FIELD(pid_t, next_pid, next->pid)
TRACE_FIELD(int, next_prio, next->prio)
),
TP_RAW_FMT("prev %d:%d ==> next %s:%d:%d")
);The above method is hard to read and requires two format fields.
The new method:
/*
* Tracepoint for task switches, performed by the scheduler:
*
* (NOTE: the 'rq' argument is not used by generic trace events,
* but used by the latency tracer plugin. )
*/
TRACE_EVENT(sched_switch,
TP_PROTO(struct rq *rq, struct task_struct *prev,
struct task_struct *next),
TP_ARGS(rq, prev, next),
TP_STRUCT__entry(
__array( char, prev_comm, TASK_COMM_LEN )
__field( pid_t, prev_pid )
__field( int, prev_prio )
__array( char, next_comm, TASK_COMM_LEN )
__field( pid_t, next_pid )
__field( int, next_prio )
),
TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
__entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
__entry->next_comm, __entry->next_pid, __entry->next_prio),
TP_fast_assign(
memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
__entry->prev_pid = prev->pid;
__entry->prev_prio = prev->prio;
memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
__entry->next_pid = next->pid;
__entry->next_prio = next->prio;
));
This macro is called TRACE_EVENT, it is broken up into 5 parts:
TP_PROTO: the proto type of the trace point
TP_ARGS: the arguments of the trace point
TP_STRUCT_entry: the structure layout of the entry in the ring buffer
TP_printk: the printk format
TP_fast_assign: the method used to write the entry into the ring buffer
The structure is the definition of how the event will be saved in the ring buffer. The printk is used by the internal tracing in case of an oops, and the kernel needs to print out the format of the record to the console. This the TP_printk gives a means to show the records in a human readable format. It is also used to print out the data from the trace file.
The TP_fast_assign is executed directly. It is basically like a C function, where the __entry is the handle to the record.
--- include/linux/tracepoint.h | 3 + include/trace/sched_event_types.h | 48 +++++++---- kernel/trace/trace.h | 5 - kernel/trace/trace_event_types.h | 3 +- kernel/trace/trace_events.c | 159 +---------------------------------- kernel/trace/trace_events_stage_1.h | 28 ++++--- kernel/trace/trace_events_stage_2.h | 89 ++++++++++++++++---- kernel/trace/trace_events_stage_3.h | 34 ++----- kernel/trace/trace_export.c | 23 +++++- 9 files changed, 159 insertions(+), 233 deletions(-)
include/linux/tracepoint.h +3 -0
@@ -160,4 +160,7 @@ static inline void tracepoint_synchronize_unregister(void)#define TRACE_EVENT_FORMAT (name, proto, args, fmt, struct, tpfmt) \ TRACE_FORMAT(name, PARAMS(proto), PARAMS(args), PARAMS(fmt)) +#define TRACE_EVENT (name, proto, args, struct, print, assign) \ + DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) +#endif
include/trace/sched_event_types.h +32 -16
57 lines not on this page · raw message
kernel/trace/trace.h +0 -5
@@ -751,12 +751,7 @@ struct ftrace_event_call {int (*regfunc)(void );void (*unregfunc)(void );int id; -struct dentry *raw_dir; -int raw_enabled; -int type;int (*raw_init)(void ); -int (*raw_reg)(void ); -void (*raw_unreg)(void );int (*show_format)(struct trace_seq *s); };
kernel/trace/trace_event_types.h +2 -1
@@ -106,9 +106,10 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore, TRACE_STRUCT( TRACE_FIELD(unsigned long, ip, ip) TRACE_FIELD(unsigned int, depth, depth) + TRACE_FIELD(char *, fmt, fmt) TRACE_FIELD_ZERO_CHAR(buf) ), - TP_RAW_FMT("%08lx (%d) %s") + TP_RAW_FMT("%08lx (%d) fmt:%p %s") ); TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
kernel/trace/trace_events.c +3 -156
218 lines not on this page · raw message
kernel/trace/trace_events_stage_1.h +16 -12
@@ -18,19 +18,23 @@#define TRACE_FORMAT (call, proto, args, fmt)#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (name, proto, args, fmt, tstruct, tpfmt) \ - struct ftrace_raw_##name { \ - struct trace_entry ent; \ - tstruct \ - }; \ - static struct ftrace_event_call event_##name +#define TRACE_EVENT_FORMAT (name, proto, args, fmt, tstruct, tpfmt) + +#undef __array +#define __array (type, item, len) type item[len]; -#undef TRACE_STRUCT -#define TRACE_STRUCT(args...) args +#undef __field +#define __field (type, item) type item; -#define TRACE_FIELD (type, item, assign) \ - type item; -#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ - type_item; +#undef TP_STRUCT__entry +#define TP_STRUCT__entry(args...) args + +#undef TRACE_EVENT +#define TRACE_EVENT (name, proto, args, tstruct, print, assign) \ + struct ftrace_raw_##name { \ + struct trace_entry ent; \ + tstruct \ + }; \ + static struct ftrace_event_call event_##name#include <trace/trace_event_types.h>
kernel/trace/trace_events_stage_2.h +71 -18
108 lines not on this page · raw message
kernel/trace/trace_events_stage_3.h +10 -24
@@ -144,27 +144,15 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ .unregfunc = ftrace_unreg_event_##call, \ } -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign)\ - entry->item = assign; - -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign)\ - entry->item = assign; - -#undef TP_CMD -#define TP_CMD(cmd...) cmd - -#undef TRACE_ENTRY -#define TRACE_ENTRY entry +#undef TRACE_EVENT_FORMAT +#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, raw) \ + TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) -#undef TRACE_FIELD_SPECIAL -#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ - cmd; +#undef __entry +#define __entry entry -#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, tpfmt) \ -_TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) \ +#undef TRACE_EVENT +#define TRACE_EVENT (call, proto, args, tstruct, print, assign) \ \ static struct ftrace_event_call event_##call; \ \
@@ -185,7 +173,7 @@ static void ftrace_raw_event_##call(proto) \return ; \ entry =ring_buffer_event_data (event); \ \ - tstruct; \ + assign; \ \trace_current_buffer_unlock_commit (event, irq_flags, pc); \ } \
@@ -226,10 +214,8 @@ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_events"))) event_##call = { \ .name = #call, \ .system = __stringify(TRACE_SYSTEM), \ - .regfunc = ftrace_reg_event_##call, \ - .unregfunc = ftrace_unreg_event_##call, \ .raw_init = ftrace_raw_init_event_##call, \ - .raw_reg = ftrace_raw_reg_event_##call, \ - .raw_unreg = ftrace_raw_unreg_event_##call, \ + .regfunc = ftrace_raw_reg_event_##call, \ + .unregfunc = ftrace_raw_unreg_event_##call, \ .show_format = ftrace_format_##call, \ }
kernel/trace/trace_export.c +22 -1
@@ -15,7 +15,28 @@#include "trace_output.h" -#include "trace_format.h" + +#undef TRACE_STRUCT +#define TRACE_STRUCT(args...) args + +#undef TRACE_FIELD +#define TRACE_FIELD (type, item, assign) \ + ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ + "offset:%u;\tsize:%u;\n", \ + (unsigned int)offsetof(typeof(field), item), \ + (unsigned int)sizeof(field.item)); \ + if (!ret) \ + return 0; + + +#undef TRACE_FIELD_SPECIAL +#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ + ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \ + "offset:%u;\tsize:%u;\n", \ + (unsigned int)offsetof(typeof(field), item), \ + (unsigned int)sizeof(field.item)); \ + if (!ret) \ + return 0;#undef TRACE_FIELD_ZERO_CHAR#define TRACE_FIELD_ZERO_CHAR (item) \
Signature · 3 lines
1.6.1.3 --
Re: [PATCH 4/7] tracing: new format for specialized trace points
Hi Steven,
Quoted 28 lines
TRACE_EVENT(sched_switch,
TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), TP_ARGS(rq, prev, next), TP_STRUCT__entry( __array( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) __field( int, prev_prio ) __array( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) __field( int, next_prio ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; __entry->prev_prio = prev->prio; memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; )
Quoted 1 line
);
Could you please write the documentation how to make new tracepont and use various TP_ macro?
Some developer (include me) plan to add new tracepoint. but these macro usage is a bit difficult.
Re: [PATCH 4/7] tracing: new format for specialized trace points
Quoted 32 lines · KOSAKI Motohiro
Hi Steven,
Quoted 28 lines
TRACE_EVENT(sched_switch,
TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), TP_ARGS(rq, prev, next), TP_STRUCT__entry( __array( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) __field( int, prev_prio ) __array( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) __field( int, next_prio ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; __entry->prev_prio = prev->prio; memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; )Quoted 1 line
);
Quoted 4 lines
Could you please write the documentation how to make new tracepont and use various
TP_macro? Some developer (include me) plan to add new tracepoint. but these macro usage is a bit difficult.
Sure, here's a commented/annotated variant:
/*
* We define a tracepoint, its arguments, its printk format
* and its 'fast binay record' layout.
*
* Firstly, name your tracepoint via TRACE_EVENT(name : the
* 'subsystem_event' notation is fine.
*
* Think about this whole construct as the
* 'trace_sched_switch() function' from now on. */
TRACE_EVENT(sched_switch,
/*
* A function has a regular function arguments
* prototype, declare it via TP_PROTO():
*/
TP_PROTO(struct rq *rq, struct task_struct *prev,
struct task_struct *next),
/*
* Define the call signature of the 'function'.
* (Design sidenote: we use this instead of a
* TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.) */
TP_ARGS(rq, prev, next),
/*
* Fast binary tracing: define the trace record via
* TP_STRUCT__entry(). You can think about it like a
* regular C structure local variable definition. *
* This is how the trace record is structured and will
* be saved into the ring buffer. These are the fields
* that will be exposed to user-space in
* /debug/tracing/events/*/format.
*
* The declared 'local variable' is called '__entry' */
TP_STRUCT__entry(
__array( char, prev_comm, TASK_COMM_LEN )
__field( pid_t, prev_pid )
__field( int, prev_prio )
__array( char, next_comm, TASK_COMM_LEN )
__field( pid_t, next_pid )
__field( int, next_prio )
),
/*
* Assign the entry into the trace record, by embedding
* a full C statement block into TP_fast_assign(). You
* can refer to the trace record as '__entry' -
* otherwise you can put arbitrary C code in here. *
* Note: this C code will execute every time a trace event
* happens, on an active tracepoint.
*/
TP_fast_assign(
memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
__entry->prev_pid = prev->pid;
__entry->prev_prio = prev->prio;
memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
__entry->next_pid = next->pid;
__entry->next_prio = next->prio;
)
/*
* Formatted output of a trace record via TP_printk().
* This is how the tracepoint will appear under ftrace
* plugins that make use of this tracepoint.
*
* (raw-binary tracing wont actually perform this step.) */
TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
__entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio),
);
This macro construct is thus used for the regular printk format tracing setup, it is used to construct a function pointer based tracepoint callback (this is used by programmatic plugins and can also by used by generic instrumentation like SystemTap), and it is also used to expose a structured trace record in /debug/tracing/events/.
Steve: i flipped around TP_fast_assign() and TP_printk() in the example above because it makes more sense that way. (we first assign the record, then we print it out) I suspect we should flip it around in the code too.
Ingo
Steven Rostedt
maintainerRe: [PATCH 4/7] tracing: new format for specialized trace points
Quoted 121 lines · Ingo Molnar
Quoted 32 lines · KOSAKI Motohiro
Hi Steven,
Quoted 28 lines
TRACE_EVENT(sched_switch,
TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), TP_ARGS(rq, prev, next), TP_STRUCT__entry( __array( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) __field( int, prev_prio ) __array( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) __field( int, next_prio ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; __entry->prev_prio = prev->prio; memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; )Quoted 1 line
);
Quoted 4 lines
Could you please write the documentation how to make new tracepont and use various
TP_macro? Some developer (include me) plan to add new tracepoint. but these macro usage is a bit difficult.Sure, here's a commented/annotated variant:
/*
* We define a tracepoint, its arguments, its printk format
* and its 'fast binay record' layout.
*
* Firstly, name your tracepoint via TRACE_EVENT(name : the
* 'subsystem_event' notation is fine.
*
* Think about this whole construct as the
* 'trace_sched_switch()function' from now on. */TRACE_EVENT(sched_switch,
/*
* A function has a regular function arguments
* prototype, declare it viaTP_PROTO():
*/(quoted diff) +0
-0TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), /* * Define the call signature of the 'function'.* (Design sidenote: we use this instead of a
* TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.) */(quoted diff) +0
-0TP_ARGS(rq, prev, next), /* * Fast binary tracing: define the trace record via * TP_STRUCT__entry(). You can think about it like a * regular C structure local variable definition. * * This is how the trace record is structured and will * be saved into the ring buffer. These are the fields * that will be exposed to user-space in * /debug/tracing/events/*/format. * * The declared 'local variable' is called '__entry' */ TP_STRUCT__entry( __array( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) __field( int, prev_prio ) __array( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) __field( int, next_prio ) ), /* * Assign the entry into the trace record, by embedding * a full C statement block into TP_fast_assign(). You * can refer to the trace record as '__entry' - * otherwise you can put arbitrary C code in here. * * Note: this C code will execute every time a trace event * happens, on an active tracepoint. */ TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; __entry->prev_prio = prev->prio; memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; ) /* * Formatted output of a trace record via TP_printk(). * This is how the tracepoint will appear under ftrace * plugins that make use of this tracepoint. * * (raw-binary tracing wont actually perform this step.) */ TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), );
Quoted 6 lines
This macro construct is thus used for the regular printk format tracing setup, it is used to construct a function pointer based tracepoint callback (this is used by programmatic plugins and can also by used by generic instrumentation like SystemTap), and it is also used to expose a structured trace record in /debug/tracing/events/.
Thanks, I'll add the above to include/linux/tracepoint.h as a documented example.
Quoted 5 lines
Steve: i flipped around
TP_fast_assign()andTP_printk()in the example above because it makes more sense that way. (we first assign the record, then we print it out) I suspect we should flip it around in the code too.
OK, I'll make that change too.
-- Steve
Re: [PATCH 4/7] tracing: new format for specialized trace points
In reply to Steven RostedtHi
I have few comment.
Quoted 5 lines
kernel/trace/trace_event_types.h +0
-0
kernel/trace/trace_event_types.h TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore, · line 113
Quoted 9 lines
kernel/trace/trace_event_types.h +2
-1@@ -106,9 +106,10 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore, TRACE_STRUCT( TRACE_FIELD(unsigned long, ip, ip) TRACE_FIELD(unsigned int, depth, depth) + TRACE_FIELD(char *, fmt, fmt) TRACE_FIELD_ZERO_CHAR(buf) ), - TP_RAW_FMT("%08lx (%d) %s") + TP_RAW_FMT("%08lx (%d) fmt:%p %s") );
I'm not sure about what mean /sys/kernel/debug/tracing/events/ftrace/print/format..
FWIW, I think the internal representation of trace_printk() is
struct print_entry {
struct trace_entry ent;
unsigned long ip;
int depth;
const char *fmt;
u32 buf[];
};then, buf doesn't gurantee NUL-termination, right?
Quoted 12 lines
kernel/trace/trace_event_types.h +0
-8@@ -665,21 +534,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events) "'%s/enable' entry\n", call->name); } -/* Only let type be writable, if we can change it */ - entry =debugfs_create_file ("type" , - call->raw_init ?0644 :0444 , - call->dir, call, - &ftrace_type_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'%s/type' entry\n" , call->name);
kernel/trace/trace_event_types.h event_create_dir(struct ftrace_event_call *call, struct dentry *d_events) · line 539
Quoted 10 lines
kernel/trace/trace_event_types.h +0
-7- - entry =debugfs_create_file ("available_types" ,0444 , call->dir, call, - &ftrace_available_types_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'%s/available_types' entry\n" , call->name); -/* A trace may not want to export its format */ if (!call->show_format)return 0 ;
this code mean, the output type of event use debug/tracing/trace_options now, right?
Quoted 4 lines
kernel/trace/trace_event_types.h +0
-0@@ -704,13 +558,6 @@ static __init int event_trace_init(void)if (!d_tracer)return 0 ;
kernel/trace/trace_event_types.h static __init int event_trace_init(void) · line 563
Quoted 10 lines
kernel/trace/trace_event_types.h +0
-7- entry =debugfs_create_file ("available_events" ,0444 , d_tracer, - (void *)&show_event_seq_ops, - &ftrace_avail_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'available_events' entry\n" ); - entry =debugfs_create_file ("set_event" ,0644 , d_tracer, (void *)&show_set_event_seq_ops, &ftrace_set_event_fops);
Why do you remove available_events file?
Quoted 35 lines
kernel/trace/trace_events_stage_2.h +6
-15@@ -32,23 +32,14 @@* in binary. */ -#undef TRACE_STRUCT -#define TRACE_STRUCT(args...) args +#undef __entry +#define __entry field -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign) \ - field->item, +#undef TP_printk +#define TP_printk(fmt, args...) fmt "\n", args -#undef TRACE_FIELD_SPECIAL -#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ - field->item, - - -#undef TP_RAW_FMT -#define TP_RAW_FMT(args...) args - -#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, tpfmt) \ +#undef TRACE_EVENT +#define TRACE_EVENT (call, proto, args, tstruct, print, assign) \ enum print_line_t \ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ { \
kernel/trace/trace_events_stage_2.h ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ · line 65
Quoted 10 lines
kernel/trace/trace_events_stage_2.h +1
-1@@ -66,14 +57,76 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ \ field = (typeof (field ))entry; \ \ - ret =trace_seq_printf (s, tpfmt"%s" , tstruct"\n" ); \ + ret =trace_seq_printf (s, print); \if (!ret) \return TRACE_TYPE_PARTIAL_LINE ; \ \return TRACE_TYPE_HANDLED ; \ }
the header comment need the same chnge too.
Quoted 41 lines
kernel/trace/trace_events_stage_2.h +0
-0#include <trace/trace_event_types.h> kernel/trace/trace_events_stage_3.h +7
-19@@ -144,27 +144,15 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ .unregfunc = ftrace_unreg_event_##call, \ } -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign)\ - entry->item = assign; - -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign)\ - entry->item = assign; - -#undef TP_CMD -#define TP_CMD(cmd...) cmd - -#undef TRACE_ENTRY -#define TRACE_ENTRY entry +#undef TRACE_EVENT_FORMAT +#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, raw) \ + TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) -#undef TRACE_FIELD_SPECIAL -#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ - cmd; +#undef __entry +#define __entry entry -#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, tpfmt) \ -_TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) \ +#undef TRACE_EVENT +#define TRACE_EVENT (call, proto, args, tstruct, print, assign) \ \ static struct ftrace_event_call event_##call; \ \
kernel/trace/trace_events_stage_3.h static void ftrace_raw_event_##call(proto) \ · line 179
Quoted 8 lines
kernel/trace/trace_events_stage_3.h +1
-1@@ -185,7 +173,7 @@ static void ftrace_raw_event_##call(proto) \return ; \ entry =ring_buffer_event_data (event); \ \ - tstruct; \ + assign; \ \trace_current_buffer_unlock_commit (event, irq_flags, pc); \ } \
ditto
kernel/trace/trace_events_stage_3.h __attribute__((__aligned__(4))) \ · line 221
Quoted 13 lines
kernel/trace/trace_events_stage_3.h +2
-4@@ -226,10 +214,8 @@ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_events"))) event_##call = { \ .name = #call, \ .system = __stringify(TRACE_SYSTEM), \ - .regfunc = ftrace_reg_event_##call, \ - .unregfunc = ftrace_unreg_event_##call, \ .raw_init = ftrace_raw_init_event_##call, \ - .raw_reg = ftrace_raw_reg_event_##call, \ - .raw_unreg = ftrace_raw_unreg_event_##call, \ + .regfunc = ftrace_raw_reg_event_##call, \ + .unregfunc = ftrace_raw_unreg_event_##call, \ .show_format = ftrace_format_##call, \ }
ditto
Steven Rostedt
maintainerRe: [PATCH 4/7] tracing: new format for specialized trace points
Quoted 32 lines · KOSAKI Motohiro
Hi
I have few comment.
Quoted 5 lines
kernel/trace/trace_event_types.h +0
-0kernel/trace/trace_event_types.h TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore, · line 113
Quoted 9 lines
kernel/trace/trace_event_types.h +2
-1@@ -106,9 +106,10 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore, TRACE_STRUCT( TRACE_FIELD(unsigned long, ip, ip) TRACE_FIELD(unsigned int, depth, depth) + TRACE_FIELD(char *, fmt, fmt) TRACE_FIELD_ZERO_CHAR(buf) ), - TP_RAW_FMT("%08lx (%d) %s") + TP_RAW_FMT("%08lx (%d) fmt:%p %s") );I'm not sure about what mean
/sys/kernel/debug/tracing/events/ftrace/print/format..FWIW, I think the internal representation of
trace_printk()isstruct print_entry { struct trace_entry ent; unsigned long ip; int depth; const char *fmt; u32 buf[]; };
Quoted 1 line
then, buf doesn't gurantee NUL-termination, right?
Right but the record has a size value, and a buf[] means that that record will take up the rest of the record.
The trace_printk is special since it is now a binary format. I'm going to export the pointers and fmts next. That way a binary reader can see what the fmt maps to.
Quoted 18 lines
Quoted 18 lines
kernel/trace/trace_event_types.h +0
-12@@ -665,21 +534,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events) "'%s/enable' entry\n", call->name); } -/* Only let type be writable, if we can change it */ - entry =debugfs_create_file ("type" , - call->raw_init ?0644 :0444 , - call->dir, call, - &ftrace_type_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'%s/type' entry\n" , call->name); - - entry =debugfs_create_file ("available_types" ,0444 , call->dir, call, - &ftrace_available_types_fops); -if (!entry)
Quoted 8 lines
kernel/trace/trace_event_types.h event_create_dir(struct ftrace_event_call *call, struct dentry *d_events) · line 539
Quoted 6 lines
kernel/trace/trace_event_types.h +0
-3-pr_warning ("Could not create debugfs " -"'%s/available_types' entry\n" , call->name); -/* A trace may not want to export its format */ if (!call->show_format)return 0 ;this code mean, the output type of event use debug/tracing/trace_options now, right?
No. The above code is the fact that the new format no longer gives an option for a trace point to be a "pretty print printf" format or a "raw" format. The new TRACE_EVENT macro is powerful enough to not need the two options. You can now have your cake and eat it too.
Quoted 6 lines
Quoted 6 lines
kernel/trace/trace_event_types.h +0
-0@@ -704,13 +558,6 @@ static __init int event_trace_init(void)if (!d_tracer)return 0 ;
Quoted 12 lines
kernel/trace/trace_event_types.h static __init int event_trace_init(void) · line 563
Quoted 10 lines
kernel/trace/trace_event_types.h +0
-7- entry =debugfs_create_file ("available_events" ,0444 , d_tracer, - (void *)&show_event_seq_ops, - &ftrace_avail_fops); -if (!entry) -pr_warning ("Could not create debugfs " -"'available_events' entry\n" ); - entry =debugfs_create_file ("set_event" ,0644 , d_tracer, (void *)&show_set_event_seq_ops, &ftrace_set_event_fops);Why do you remove
available_eventsfile?
Arg! Good catch! That was me getting too happy with the knife. I'll add that back.
Quoted 41 lines
Quoted 41 lines
kernel/trace/trace_events_stage_2.h +6
-16@@ -32,23 +32,14 @@* in binary. */ -#undef TRACE_STRUCT -#define TRACE_STRUCT(args...) args +#undef __entry +#define __entry field -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign) \ - field->item, +#undef TP_printk +#define TP_printk(fmt, args...) fmt "\n", args -#undef TRACE_FIELD_SPECIAL -#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ - field->item, - - -#undef TP_RAW_FMT -#define TP_RAW_FMT(args...) args - -#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, tpfmt) \ +#undef TRACE_EVENT +#define TRACE_EVENT (call, proto, args, tstruct, print, assign) \ enum print_line_t \ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ { \@@ -66,14 +57,76 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ \ field = (typeof (field ))entry; \ \ - ret =trace_seq_printf (s, tpfmt"%s" , tstruct"\n" ); \
Quoted 8 lines
kernel/trace/trace_events_stage_2.h ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ · line 65
Quoted 6 lines
kernel/trace/trace_events_stage_2.h +1
-0+ ret =trace_seq_printf (s, print); \if (!ret) \return TRACE_TYPE_PARTIAL_LINE ; \ \return TRACE_TYPE_HANDLED ; \ }the header comment need the same chnge too.
I'll change it once more, but if I find that I need to maintain two versions, the comment and the header, I will simply cut out the entire comment. I only did the comment because I thought it would be easier than reading the macros. Not sure it is worth the trouble.
Thanks for the review,
-- Steve
Quoted 73 lines
Quoted 43 lines
kernel/trace/trace_events_stage_2.h +0
-0#include <trace/trace_event_types.h> kernel/trace/trace_events_stage_3.h +7
-19@@ -144,27 +144,15 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ .unregfunc = ftrace_unreg_event_##call, \ } -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign)\ - entry->item = assign; - -#undef TRACE_FIELD -#define TRACE_FIELD (type, item, assign)\ - entry->item = assign; - -#undef TP_CMD -#define TP_CMD(cmd...) cmd - -#undef TRACE_ENTRY -#define TRACE_ENTRY entry +#undef TRACE_EVENT_FORMAT +#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, raw) \ + TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) -#undef TRACE_FIELD_SPECIAL -#define TRACE_FIELD_SPECIAL (type_item, item, cmd) \ - cmd; +#undef __entry +#define __entry entry -#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, tpfmt) \ -_TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) \ +#undef TRACE_EVENT +#define TRACE_EVENT (call, proto, args, tstruct, print, assign) \ \ static struct ftrace_event_call event_##call; \ \kernel/trace/trace_events_stage_3.h static void ftrace_raw_event_##call(proto) \ · line 179
Quoted 8 lines
kernel/trace/trace_events_stage_3.h +1
-1@@ -185,7 +173,7 @@ static void ftrace_raw_event_##call(proto) \return ; \ entry =ring_buffer_event_data (event); \ \ - tstruct; \ + assign; \ \trace_current_buffer_unlock_commit (event, irq_flags, pc); \ } \ditto
kernel/trace/trace_events_stage_3.h __attribute__((__aligned__(4))) \ · line 221
Quoted 13 lines
kernel/trace/trace_events_stage_3.h +2
-4@@ -226,10 +214,8 @@ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_events"))) event_##call = { \ .name = #call, \ .system = __stringify(TRACE_SYSTEM), \ - .regfunc = ftrace_reg_event_##call, \ - .unregfunc = ftrace_unreg_event_##call, \ .raw_init = ftrace_raw_init_event_##call, \ - .raw_reg = ftrace_raw_reg_event_##call, \ - .raw_unreg = ftrace_raw_unreg_event_##call, \ + .regfunc = ftrace_raw_reg_event_##call, \ + .unregfunc = ftrace_raw_unreg_event_##call, \ .show_format = ftrace_format_##call, \ }ditto
Re: [PATCH 4/7] tracing: new format for specialized trace points
In reply to Steven RostedtQuoted 2 lines · Steven Rostedt
Here's the example. The only updated macro in this patch is the
sched_switchtrace point.
Note that we shouldn't keep two variants around long-term, that's just going to cause confusion.
Quoted 60 lines
The old method looked like this:
TRACE_EVENT_FORMAT(sched_switch,
TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), TP_ARGS(rq, prev, next), TP_FMT("task %s:%d ==> %s:%d", prev->comm, prev->pid, next->comm, next->pid), TRACE_STRUCT( TRACE_FIELD(pid_t, prev_pid, prev->pid) TRACE_FIELD(int, prev_prio, prev->prio) TRACE_FIELD_SPECIAL(char next_comm[TASK_COMM_LEN], next_comm, TP_CMD(memcpy(TRACE_ENTRY->next_comm, next->comm, TASK_COMM_LEN))) TRACE_FIELD(pid_t, next_pid, next->pid) TRACE_FIELD(int, next_prio, next->prio) ), TP_RAW_FMT("prev %d:%d ==> next %s:%d:%d") );The above method is hard to read and requires two format fields.
The new method:
/*
* Tracepoint for task switches, performed by the scheduler:
*
* (NOTE: the 'rq' argument is not used by generic trace events,
* but used by the latency tracer plugin. )
*/
TRACE_EVENT(sched_switch,TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), TP_ARGS(rq, prev, next), TP_STRUCT__entry( __array( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) __field( int, prev_prio ) __array( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) __field( int, next_prio ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; __entry->prev_prio = prev->prio; memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; )
Quoted 1 line
);
While the idea behing it seems like an improvement to me, the implementation feel actually worse than the old one too me. I would expect this to look more like:
struct trace_sched_switch {
char prev_comm[TASK_COMM_LEN],
pid_t prev_pid,
int prev_prio,
char next_comm[TASK_COMM_LEN],
pid_t next_pid,
int next_prio,
}static void trace_sched_assign(struct trace_sched_switch *dst, struct rq *rq,
struct task_struct *prev, struct task_struct *next)
{
memcpy(dst->next_comm, next->comm, TASK_COMM_LEN);
dst->prev_pid = prev->pid;
dst->prev_prio = prev->prio;
memcpy(dst->prev_comm, prev->comm, TASK_COMM_LEN);
dst->next_pid = next->pid;
dst->next_prio = next->prio;
};TRACE_EVENT(sched_switch,
trace_proto(struct rq *rq, struct task_struct *prev,
struct task_struct *next),
trace_args(rq, prev, next),
trace_struct(struct trace_sched_switch),
trace_assign(trace_sched_assign);
trace_pretty_print("task %s:%d [%d] ==> %s:%d [%d]",
__entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
__entry->next_comm, __entry->next_pid, __entry->next_prio),);
Steven Rostedt
maintainerRe: [PATCH 4/7] tracing: new format for specialized trace points
Quoted 73 lines · Christoph Hellwig
Quoted 2 lines · Steven Rostedt
Here's the example. The only updated macro in this patch is the
sched_switchtrace point.Note that we shouldn't keep two variants around long-term, that's just going to cause confusion.
Quoted 60 lines
The old method looked like this:
TRACE_EVENT_FORMAT(sched_switch,
TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), TP_ARGS(rq, prev, next), TP_FMT("task %s:%d ==> %s:%d", prev->comm, prev->pid, next->comm, next->pid), TRACE_STRUCT( TRACE_FIELD(pid_t, prev_pid, prev->pid) TRACE_FIELD(int, prev_prio, prev->prio) TRACE_FIELD_SPECIAL(char next_comm[TASK_COMM_LEN], next_comm, TP_CMD(memcpy(TRACE_ENTRY->next_comm, next->comm, TASK_COMM_LEN))) TRACE_FIELD(pid_t, next_pid, next->pid) TRACE_FIELD(int, next_prio, next->prio) ), TP_RAW_FMT("prev %d:%d ==> next %s:%d:%d") );The above method is hard to read and requires two format fields.
The new method:
/*
* Tracepoint for task switches, performed by the scheduler:
*
* (NOTE: the 'rq' argument is not used by generic trace events,
* but used by the latency tracer plugin. )
*/
TRACE_EVENT(sched_switch,TP_PROTO(struct rq *rq, struct task_struct *prev, struct task_struct *next), TP_ARGS(rq, prev, next), TP_STRUCT__entry( __array( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) __field( int, prev_prio ) __array( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) __field( int, next_prio ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; __entry->prev_prio = prev->prio; memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; )Quoted 1 line
);
While the idea behing it seems like an improvement to me, the implementation feel actually worse than the old one too me. I would expect this to look more like:
Quoted 8 lines
struct trace_sched_switch {
char prev_comm[TASK_COMM_LEN],
pid_t prev_pid,
int prev_prio,
char next_comm[TASK_COMM_LEN],
pid_t next_pid,
int next_prio,
}We would love to do the above. The problem is that we also need a way to automatically export the fields offset/size to userspace. Thus we use the "__field()" and "__array()" macros to do this for us. Otherwise, we need to do that manually.
Quoted 11 lines
static void trace_sched_assign(struct
trace_sched_switch*dst, struct rq *rq,
structtask_struct*prev, structtask_struct*next){ memcpy(dst->next_comm, next->comm, TASK_COMM_LEN); dst->prev_pid = prev->pid; dst->prev_prio = prev->prio; memcpy(dst->prev_comm, prev->comm, TASK_COMM_LEN); dst->next_pid = next->pid; dst->next_prio = next->prio; };
This we could take out of the macro and make a function.
-- Steve
Quoted 15 lines
TRACE_EVENT(sched_switch,
trace_proto(struct rq *rq, structtask_struct*prev,
structtask_struct*next),trace_args(rq, prev, next), trace_struct(struct trace_sched_switch), trace_assign(trace_sched_assign); trace_pretty_print("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio),);
Steven Rostedt
maintainerPATCH 5/7 tracing: convert the sched trace points to the TRACE_EVENT macros
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: enhancement
This patch converts the rest of the sched trace points to use the new more powerful TRACE_EVENT macro.
--- include/trace/sched_event_types.h | 322 ++++++++++++++++++++++++++++--------- 1 files changed, 246 insertions(+), 76 deletions(-)
include/trace/sched_event_types.h +246 -76
@@ -8,59 +8,137 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM sched -TRACE_EVENT_FORMAT (sched_kthread_stop, +/* +* Tracepoint for calling kthread_stop, performed to end a kthread: +*/ +TRACE_EVENT (sched_kthread_stop, + TP_PROTO(struct task_struct *t), +TP_ARGS (t), -TP_FMT ("task %s:%d" , t->comm, t->pid), -TRACE_STRUCT ( -TRACE_FIELD (pid_t, pid, t->pid) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) +__field ( pid_t, pid ) ), -TP_RAW_FMT ("task %d" ) - ); -TRACE_EVENT_FORMAT (sched_kthread_stop_ret, +TP_printk ("task %s:%d" , __entry->comm, __entry->pid), + +TP_fast_assign ( + memcpy(__entry->comm, t->comm, TASK_COMM_LEN); + __entry->pid = t->pid; + ) +); + +/* +* Tracepoint for the return value of the kthread stopping: +*/ +TRACE_EVENT (sched_kthread_stop_ret, + TP_PROTO(int ret), +TP_ARGS (ret), -TP_FMT ("ret=%d" , ret), -TRACE_STRUCT ( -TRACE_FIELD (int, ret, ret) + +TP_STRUCT__entry ( +__field ( int, ret ) ), -TP_RAW_FMT ("ret=%d" ) - ); -TRACE_EVENT_FORMAT (sched_wait_task, +TP_printk ("ret %d" , __entry->ret), + +TP_fast_assign ( + __entry->ret = ret; + ) +); + +/* +* Tracepoint for waiting on task to unschedule: +* +* (NOTE: the 'rq' argument is not used by generic trace events, +* but used by the latency tracer plugin. ) +*/ +TRACE_EVENT (sched_wait_task, + TP_PROTO(struct rq *rq, struct task_struct *p), +TP_ARGS (rq, p), -TP_FMT ("task %s:%d" , p->comm, p->pid), -TRACE_STRUCT ( -TRACE_FIELD (pid_t, pid, p->pid) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) +__field ( int, prio ) ), -TP_RAW_FMT ("task %d" ) - ); -TRACE_EVENT_FORMAT (sched_wakeup, +TP_printk ("task %s:%d [%d]" , + __entry->comm, __entry->pid, __entry->prio), + +TP_fast_assign ( + memcpy(__entry->comm, p->comm, TASK_COMM_LEN); + __entry->pid = p->pid; + __entry->prio = p->prio; + ) +); + +/* +* Tracepoint for waking up a task: +* +* (NOTE: the 'rq' argument is not used by generic trace events, +* but used by the latency tracer plugin. ) +*/ +TRACE_EVENT (sched_wakeup, + TP_PROTO(struct rq *rq, struct task_struct *p, int success), +TP_ARGS (rq, p, success), -TP_FMT ("task %s:%d %s" , - p->comm, p->pid, success ?"succeeded" :"failed" ), -TRACE_STRUCT ( - TRACE_FIELD(pid_t, pid, p->pid) -TRACE_FIELD (int, success, success) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( int, prio ) +__field ( int, success ) ), -TP_RAW_FMT ("task %d success=%d" ) - ); -TRACE_EVENT_FORMAT (sched_wakeup_new, +TP_printk ("task %s:%d [%d] success=%d" , + __entry->comm, __entry->pid, __entry->prio, + __entry->success), + +TP_fast_assign ( + memcpy(__entry->comm, p->comm, TASK_COMM_LEN); + __entry->pid = p->pid; + __entry->prio = p->prio; + __entry->success = success; + ) +); + +/* +* Tracepoint for waking up a new task: +* +* (NOTE: the 'rq' argument is not used by generic trace events, +* but used by the latency tracer plugin. ) +*/ +TRACE_EVENT (sched_wakeup_new, + TP_PROTO(struct rq *rq, struct task_struct *p, int success), +TP_ARGS (rq, p, success), -TP_FMT ("task %s:%d" , - p->comm, p->pid, success ?"succeeded" :"failed" ), -TRACE_STRUCT ( - TRACE_FIELD(pid_t, pid, p->pid) -TRACE_FIELD (int, success, success) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( int, prio ) +__field ( int, success ) ), -TP_RAW_FMT ("task %d success=%d" ) - ); + +TP_printk ("task %s:%d [%d] success=%d" , + __entry->comm, __entry->pid, __entry->prio, + __entry->success), + +TP_fast_assign ( + memcpy(__entry->comm, p->comm, TASK_COMM_LEN); + __entry->pid = p->pid; + __entry->prio = p->prio; + __entry->success = success; + ) +);/* * Tracepoint for task switches, performed by the scheduler:
@@ -98,70 +176,162 @@ TRACE_EVENT(sched_switch, ) ); -TRACE_EVENT_FORMAT (sched_migrate_task, +/* +* Tracepoint for a task being migrated: +*/ +TRACE_EVENT (sched_migrate_task, + TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu), +TP_ARGS (p, orig_cpu, dest_cpu), -TP_FMT ("task %s:%d from: %d to: %d" , - p->comm, p->pid, orig_cpu, dest_cpu), -TRACE_STRUCT ( - TRACE_FIELD(pid_t, pid, p->pid) - TRACE_FIELD(int, orig_cpu, orig_cpu) -TRACE_FIELD (int, dest_cpu, dest_cpu) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( int, prio ) + __field( int, orig_cpu ) +__field ( int, dest_cpu ) ), -TP_RAW_FMT ("task %d from: %d to: %d" ) - ); -TRACE_EVENT_FORMAT (sched_process_free, +TP_printk ("task %s:%d [%d] from: %d to: %d" , + __entry->comm, __entry->pid, __entry->prio, + __entry->orig_cpu, __entry->dest_cpu), + +TP_fast_assign ( + memcpy(__entry->comm, p->comm, TASK_COMM_LEN); + __entry->pid = p->pid; + __entry->prio = p->prio; + __entry->orig_cpu = orig_cpu; + __entry->dest_cpu = dest_cpu; + ) +); + +/* +* Tracepoint for freeing a task: +*/ +TRACE_EVENT (sched_process_free, + TP_PROTO(struct task_struct *p), +TP_ARGS (p), -TP_FMT ("task %s:%d" , p->comm, p->pid), -TRACE_STRUCT ( -TRACE_FIELD (pid_t, pid, p->pid) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) +__field ( int, prio ) ), -TP_RAW_FMT ("task %d" ) - ); -TRACE_EVENT_FORMAT (sched_process_exit, +TP_printk ("task %s:%d [%d]" , + __entry->comm, __entry->pid, __entry->prio), + +TP_fast_assign ( + memcpy(__entry->comm, p->comm, TASK_COMM_LEN); + __entry->pid = p->pid; + __entry->prio = p->prio; + ) +); + +/* +* Tracepoint for a task exiting: +*/ +TRACE_EVENT (sched_process_exit, + TP_PROTO(struct task_struct *p), +TP_ARGS (p), -TP_FMT ("task %s:%d" , p->comm, p->pid), -TRACE_STRUCT ( -TRACE_FIELD (pid_t, pid, p->pid) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) +__field ( int, prio ) ), -TP_RAW_FMT ("task %d" ) - ); -TRACE_EVENT_FORMAT (sched_process_wait, +TP_printk ("task %s:%d [%d]" , + __entry->comm, __entry->pid, __entry->prio), + +TP_fast_assign ( + memcpy(__entry->comm, p->comm, TASK_COMM_LEN); + __entry->pid = p->pid; + __entry->prio = p->prio; + ) +); + +/* +* Tracepoint for a waiting task: +*/ +TRACE_EVENT (sched_process_wait, + TP_PROTO(struct pid *pid), +TP_ARGS (pid), -TP_FMT ("pid %d" ,pid_nr (pid)), -TRACE_STRUCT ( -TRACE_FIELD (pid_t, pid,pid_nr (pid)) + +TP_STRUCT__entry ( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) +__field ( int, prio ) ), -TP_RAW_FMT ("task %d" ) - ); -TRACE_EVENT_FORMAT (sched_process_fork, +TP_printk ("task %s:%d [%d]" , + __entry->comm, __entry->pid, __entry->prio), + +TP_fast_assign ( + memcpy(__entry->comm, current->comm, TASK_COMM_LEN); + __entry->pid = pid_nr(pid); + __entry->prio = current->prio; + ) +); + +/* +* Tracepoint for do_fork: +*/ +TRACE_EVENT (sched_process_fork, + TP_PROTO(struct task_struct *parent, struct task_struct *child), +TP_ARGS (parent, child), -TP_FMT ("parent %s:%d child %s:%d" , - parent->comm, parent->pid, child->comm, child->pid), -TRACE_STRUCT ( - TRACE_FIELD(pid_t, parent, parent->pid) -TRACE_FIELD (pid_t, child, child->pid) + +TP_STRUCT__entry ( + __array( char, parent_comm, TASK_COMM_LEN ) + __field( pid_t, parent_pid ) + __array( char, child_comm, TASK_COMM_LEN ) +__field ( pid_t, child_pid ) ), -TP_RAW_FMT ("parent %d child %d" ) - ); -TRACE_EVENT_FORMAT (sched_signal_send, +TP_printk ("parent %s:%d child %s:%d" , + __entry->parent_comm, __entry->parent_pid, + __entry->child_comm, __entry->child_pid), + +TP_fast_assign ( + memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); + __entry->parent_pid = parent->pid; + memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); + __entry->child_pid = child->pid; + ) +); + +/* +* Tracepoint for sending a signal: +*/ +TRACE_EVENT (sched_signal_send, + TP_PROTO(int sig, struct task_struct *p), +TP_ARGS (sig, p), -TP_FMT ("sig: %d task %s:%d" , sig, p->comm, p->pid), -TRACE_STRUCT ( - TRACE_FIELD(int, sig, sig) -TRACE_FIELD (pid_t, pid, p->pid) + +TP_STRUCT__entry ( + __field( int, sig ) + __array( char, comm, TASK_COMM_LEN ) +__field ( pid_t, pid ) ), -TP_RAW_FMT ("sig: %d task %d" ) - ); + +TP_printk ("sig: %d task %s:%d" , + __entry->sig, __entry->comm, __entry->pid), + +TP_fast_assign ( + memcpy(__entry->comm, p->comm, TASK_COMM_LEN); + __entry->pid = p->pid; + __entry->sig = sig; + ) +);#undef TRACE_SYSTEM
Signature · 3 lines
1.6.1.3 --
Steven Rostedt
maintainerPATCH 6/7 tracing: convert irq trace points to new macros
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: enhancement
Converted the two irq trace point macros. The entry macro copies the name of the irq handler, thus it is better to simply use the TRACE_FORMAT macro which uses the trace_printk.
The return of the handler does not need to record the name, thus the faster C style handler is more approriate.
--- include/trace/irq_event_types.h | 38 ++++++++++++++++++++++++-------------- 1 files changed, 24 insertions(+), 14 deletions(-)
include/trace/irq_event_types.h +24 -14
@@ -8,26 +8,36 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM irq -TRACE_EVENT_FORMAT (irq_handler_entry, +/* +* Tracepoint for entry of interrupt handler: +*/ +TRACE_FORMAT (irq_handler_entry, TP_PROTO(int irq, struct irqaction *action),TP_ARGS (irq, action), -TP_FMT ("irq=%d handler=%s" , irq, action->name), -TRACE_STRUCT ( -TRACE_FIELD (int, irq, irq) - ), -TP_RAW_FMT ("irq %d" ) +TP_FMT ("irq=%d handler=%s" , irq, action->name) ); -TRACE_EVENT_FORMAT (irq_handler_exit, +/* +* Tracepoint for return of an interrupt handler: +*/ +TRACE_EVENT (irq_handler_exit, + TP_PROTO(int irq, struct irqaction *action, int ret), +TP_ARGS (irq, action, ret), -TP_FMT ("irq=%d handler=%s return=%s" , - irq, action->name, ret ?"handled" :"unhandled" ), -TRACE_STRUCT ( - TRACE_FIELD(int, irq, irq) -TRACE_FIELD (int, ret, ret) + +TP_STRUCT__entry ( + __field( int, irq ) +__field ( int, ret ) ), -TP_RAW_FMT ("irq %d ret %d" ) - ); + +TP_printk ("irq=%d return=%s" , + __entry->irq, __entry->ret ?"handled" :"unhandled" ), + +TP_fast_assign ( + __entry->irq = irq; + __entry->ret = ret; + ) +);#undef TRACE_SYSTEM
Signature · 3 lines
1.6.1.3 --
Steven Rostedt
maintainerPATCH 7/7 tracing: remove obsolete TRACE_EVENT_FORMAT macro
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: clean up
The TRACE_EVENT_FORMAT macro is no longer used by trace points and only the DECLARE_TRACE, TRACE_FORMAT or TRACE_EVENT macros should be used by them. Although the TRACE_EVENT_FORMAT macro is still used by the internal tracing utility, it should not be used in core kernel code.
--- include/linux/tracepoint.h | 3 --- include/trace/lockdep_event_types.h | 2 +- include/trace/sched_event_types.h | 2 +- kernel/trace/trace_events_stage_1.h | 3 --- kernel/trace/trace_events_stage_3.h | 6 +----- 5 files changed, 3 insertions(+), 13 deletions(-)
include/linux/tracepoint.h +0 -3
@@ -157,9 +157,6 @@ static inline void tracepoint_synchronize_unregister(void)#define TRACE_FORMAT (name, proto, args, fmt) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) -#define TRACE_EVENT_FORMAT (name, proto, args, fmt, struct, tpfmt) \ - TRACE_FORMAT(name, PARAMS(proto), PARAMS(args), PARAMS(fmt)) -#define TRACE_EVENT (name, proto, args, struct, print, assign) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
include/trace/lockdep_event_types.h +1 -1
@@ -1,5 +1,5 @@ -#ifndef TRACE_EVENT_FORMAT +#ifndef TRACE_FORMAT # error Do not include this file directly.# error Unless you know what you are doing.#endif
include/trace/sched_event_types.h +1 -1
@@ -1,6 +1,6 @@/* use <trace/sched.h> instead */ -#ifndef TRACE_EVENT_FORMAT +#ifndef TRACE_EVENT # error Do not include this file directly.# error Unless you know what you are doing.#endif
kernel/trace/trace_events_stage_1.h +0 -3
@@ -17,9 +17,6 @@#undef TRACE_FORMAT#define TRACE_FORMAT (call, proto, args, fmt) -#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (name, proto, args, fmt, tstruct, tpfmt) -#undef __array#define __array (type, item, len) type item[len];
kernel/trace/trace_events_stage_3.h +1 -5
@@ -35,7 +35,7 @@* } * * -* For those macros defined with TRACE_EVENT_FORMAT: +* For those macros defined with TRACE_EVENT: * * static struct ftrace_event_call event_<call>; *
@@ -144,10 +144,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ .unregfunc = ftrace_unreg_event_##call, \ } -#undef TRACE_EVENT_FORMAT -#define TRACE_EVENT_FORMAT (call, proto, args, fmt, tstruct, raw) \ - TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) -#undef __entry#define __entry entry
Signature · 3 lines
1.6.1.3 --
Re: [PATCH 7/7] tracing: remove obsolete TRACE_EVENT_FORMAT macro
Ah, the old one is gone here, ok..
Quoted 6 lines · Steven Rostedt
Ingo,
This patch series replaces the
TRACE_EVENT_FORMATwith the newTRACE_EVENT
Quoted 6 lines
NOTE: I started with a pull from tip/tracing/printk. It does not show up as a merge since I did the pull at the point where it forked. But by pulling this branch, you will also receive your changes from tracing/printk. I rebased my changes off of this pull so that my changes would be after the pull, making this patch series cleaner.
(that's OK - tracing/printk is still an active branch.)
Quoted 28 lines
Please pull the latest tip/tracing/ftrace tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/ftraceSteven Rostedt (7):
tracing: typecast sizeof and offsetof to unsigned int
tracing: replace TP<var> with TP_<var>
tracing: use generic__stringify
tracing: new format for specialized trace points
tracing: convert the sched trace points to theTRACE_EVENTmacros
tracing: convert irq trace points to new macros
tracing: remove obsoleteTRACE_EVENT_FORMATmacro----
Documentation/tracepoints.txt | 8 +- include/linux/tracepoint.h | 10 +- include/trace/block.h | 70 +++--- include/trace/irq_event_types.h | 46 ++-- include/trace/lockdep_event_types.h | 26 +- include/trace/power.h | 12 +- include/trace/sched_event_types.h | 442 +++++++++++++++++++++++--------- include/trace/workqueue.h | 16 +- kernel/trace/events.c | 4 +- kernel/trace/trace.h | 5 - kernel/trace/trace_event_types.h | 29 +- kernel/trace/trace_events.c | 174 +------------
Quoted 8 lines
kernel/trace/trace_events_stage_1.h | 27 +- kernel/trace/trace_events_stage_2.h | 91 +++++-- kernel/trace/trace_events_stage_3.h | 42 +--- kernel/trace/trace_export.c | 41 +++- kernel/trace/trace_format.h | 55 ---- kernel/trace/trace_selftest.c | 6 +- samples/tracepoints/tp-samples-trace.h | 8 +- 19 files changed, 575 insertions(+), 537 deletions(-)
Pulled, thanks Steve! (i suspect you'll fix the %z thing Andrew noticed in the next drop.)
Ingo