]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
tracing: add ftrace headers to event format files
authorSteven Rostedt <srostedt@redhat.com>
Mon, 2 Mar 2009 20:03:01 +0000 (15:03 -0500)
committerSteven Rostedt <srostedt@redhat.com>
Mon, 2 Mar 2009 20:03:01 +0000 (15:03 -0500)
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>
kernel/trace/trace_events.c

index d57a772981c12550e2c3cf95c895efaa521feaf9..cdcc3aed76fdaa9c79d436574ef45acfcc9775fa 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/module.h>
 #include <linux/ctype.h>
 
-#include "trace.h"
+#include "trace_output.h"
 
 #define TRACE_SYSTEM "TRACE_SYSTEM"
 
@@ -447,6 +447,28 @@ event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt,
        return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
 }
 
+#undef FIELD
+#define FIELD(type, name) \
+       #type, #name, offsetof(typeof(field), name), sizeof(field.name)
+
+static int trace_write_header(struct trace_seq *s)
+{
+       struct trace_entry field;
+
+       /* 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"
+                               "\n",
+                               FIELD(unsigned char, type),
+                               FIELD(unsigned char, flags),
+                               FIELD(unsigned char, preempt_count),
+                               FIELD(int, pid),
+                               FIELD(int, tgid));
+}
 static ssize_t
 event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
                  loff_t *ppos)
@@ -465,6 +487,9 @@ event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
        if (*ppos)
                return 0;
 
+       /* If this fails, so will the show_format. */
+       trace_write_header(s);
+
        r = call->show_format(s);
        if (!r) {
                /*