diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-02 15:03:01 -0500 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-02 15:03:01 -0500 |
commit | 91729ef96661bfa7dc53923746cd90b62d5495cc (patch) | |
tree | 421dcc26559806162b911e09a47f82012833ab89 /kernel/trace/trace_events.c | |
parent | 981d081ec8b958b7d962ee40d433581a55d40fc5 (diff) |
tracing: add ftrace headers to event format files
This patch includes the ftrace header to the event formats files:
# cat /debug/tracing/events/sched/sched_switch/format
field:unsigned char type; offset:0; size:1;
field:unsigned char flags; offset:1; size:1;
field:unsigned char preempt_count; offset:2; size:1;
field:int pid; offset:4; size:4;
field:int tgid; offset:8; size:4;
field:pid_t prev_pid; offset:12; size:4;
field:int prev_prio; offset:16; size:4;
field special:char next_comm[TASK_COMM_LEN]; offset:20; size:16;
field:pid_t next_pid; offset:36; size:4;
field:int next_prio; offset:40; size:4;
A blank line is used as a deliminator between the ftrace header and the
trace point fields.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index d57a772981c1..cdcc3aed76fd 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
15 | 15 | ||
16 | #include "trace.h" | 16 | #include "trace_output.h" |
17 | 17 | ||
18 | #define TRACE_SYSTEM "TRACE_SYSTEM" | 18 | #define TRACE_SYSTEM "TRACE_SYSTEM" |
19 | 19 | ||
@@ -447,6 +447,28 @@ event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
447 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); | 447 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); |
448 | } | 448 | } |
449 | 449 | ||
450 | #undef FIELD | ||
451 | #define FIELD(type, name) \ | ||
452 | #type, #name, offsetof(typeof(field), name), sizeof(field.name) | ||
453 | |||
454 | static int trace_write_header(struct trace_seq *s) | ||
455 | { | ||
456 | struct trace_entry field; | ||
457 | |||
458 | /* struct trace_entry */ | ||
459 | return trace_seq_printf(s, | ||
460 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
461 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
462 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
463 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
464 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
465 | "\n", | ||
466 | FIELD(unsigned char, type), | ||
467 | FIELD(unsigned char, flags), | ||
468 | FIELD(unsigned char, preempt_count), | ||
469 | FIELD(int, pid), | ||
470 | FIELD(int, tgid)); | ||
471 | } | ||
450 | static ssize_t | 472 | static ssize_t |
451 | event_format_read(struct file *filp, char __user *ubuf, size_t cnt, | 473 | event_format_read(struct file *filp, char __user *ubuf, size_t cnt, |
452 | loff_t *ppos) | 474 | loff_t *ppos) |
@@ -465,6 +487,9 @@ event_format_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
465 | if (*ppos) | 487 | if (*ppos) |
466 | return 0; | 488 | return 0; |
467 | 489 | ||
490 | /* If this fails, so will the show_format. */ | ||
491 | trace_write_header(s); | ||
492 | |||
468 | r = call->show_format(s); | 493 | r = call->show_format(s); |
469 | if (!r) { | 494 | if (!r) { |
470 | /* | 495 | /* |