]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86, ftrace: call trace->open() before stopping tracing; add trace->print_header()
authorMarkus Metzger <markus.t.metzger@intel.com>
Tue, 25 Nov 2008 08:12:31 +0000 (09:12 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 25 Nov 2008 16:31:13 +0000 (17:31 +0100)
Add a callback to allow an ftrace plug-in to write its own header.

Move the call to trace->open() up a few lines.

The changes are required by the BTS ftrace plug-in.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace.c
kernel/trace/trace.h

index a45b59e53fbc240f5cb1d29fb09ae5c0b1cfe62d..8df8fdd69c954f19fbf9c0341c0281c3778af975 100644 (file)
@@ -2298,7 +2298,9 @@ static int s_show(struct seq_file *m, void *v)
                        seq_printf(m, "# tracer: %s\n", iter->trace->name);
                        seq_puts(m, "#\n");
                }
-               if (iter->iter_flags & TRACE_FILE_LAT_FMT) {
+               if (iter->trace && iter->trace->print_header)
+                       iter->trace->print_header(m);
+               else if (iter->iter_flags & TRACE_FILE_LAT_FMT) {
                        /* print nothing if the buffers are empty */
                        if (trace_empty(iter))
                                return 0;
@@ -2350,6 +2352,10 @@ __tracing_open(struct inode *inode, struct file *file, int *ret)
        iter->trace = current_trace;
        iter->pos = -1;
 
+       /* Notify the tracer early; before we stop tracing. */
+       if (iter->trace && iter->trace->open)
+                       iter->trace->open(iter);
+
        /* Annotate start of buffers if we had overruns */
        if (ring_buffer_overruns(iter->tr->buffer))
                iter->iter_flags |= TRACE_FILE_ANNOTATE;
@@ -2375,9 +2381,6 @@ __tracing_open(struct inode *inode, struct file *file, int *ret)
        /* stop the trace while dumping */
        tracing_stop();
 
-       if (iter->trace && iter->trace->open)
-                       iter->trace->open(iter);
-
        mutex_unlock(&trace_types_lock);
 
  out:
index 28c15c2ebc2272dde5705fcd03c67c5c24c6e0ae..717f9f045c6fdff912bd00dcd8f723cdaab41624 100644 (file)
@@ -311,6 +311,7 @@ struct tracer {
        int                     (*selftest)(struct tracer *trace,
                                            struct trace_array *tr);
 #endif
+       void                    (*print_header)(struct seq_file *m);
        enum print_line_t       (*print_line)(struct trace_iterator *iter);
        /* If you handled the flag setting, return 0 */
        int                     (*set_flag)(u32 old_flags, u32 bit, int set);