diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2008-11-25 03:12:31 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-25 11:31:13 -0500 |
commit | 8bba1bf5e2434c83f2fe8b1422604ace9bbe4cb8 (patch) | |
tree | 3df07de04de7e3a838dbf544e6a98eadac37b027 /kernel | |
parent | 6abb11aecd888d1da6276399380b7355f127c006 (diff) |
x86, ftrace: call trace->open() before stopping tracing; add trace->print_header()
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 11 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a45b59e53fbc..8df8fdd69c95 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -2298,7 +2298,9 @@ static int s_show(struct seq_file *m, void *v) | |||
2298 | seq_printf(m, "# tracer: %s\n", iter->trace->name); | 2298 | seq_printf(m, "# tracer: %s\n", iter->trace->name); |
2299 | seq_puts(m, "#\n"); | 2299 | seq_puts(m, "#\n"); |
2300 | } | 2300 | } |
2301 | if (iter->iter_flags & TRACE_FILE_LAT_FMT) { | 2301 | if (iter->trace && iter->trace->print_header) |
2302 | iter->trace->print_header(m); | ||
2303 | else if (iter->iter_flags & TRACE_FILE_LAT_FMT) { | ||
2302 | /* print nothing if the buffers are empty */ | 2304 | /* print nothing if the buffers are empty */ |
2303 | if (trace_empty(iter)) | 2305 | if (trace_empty(iter)) |
2304 | return 0; | 2306 | return 0; |
@@ -2350,6 +2352,10 @@ __tracing_open(struct inode *inode, struct file *file, int *ret) | |||
2350 | iter->trace = current_trace; | 2352 | iter->trace = current_trace; |
2351 | iter->pos = -1; | 2353 | iter->pos = -1; |
2352 | 2354 | ||
2355 | /* Notify the tracer early; before we stop tracing. */ | ||
2356 | if (iter->trace && iter->trace->open) | ||
2357 | iter->trace->open(iter); | ||
2358 | |||
2353 | /* Annotate start of buffers if we had overruns */ | 2359 | /* Annotate start of buffers if we had overruns */ |
2354 | if (ring_buffer_overruns(iter->tr->buffer)) | 2360 | if (ring_buffer_overruns(iter->tr->buffer)) |
2355 | iter->iter_flags |= TRACE_FILE_ANNOTATE; | 2361 | iter->iter_flags |= TRACE_FILE_ANNOTATE; |
@@ -2375,9 +2381,6 @@ __tracing_open(struct inode *inode, struct file *file, int *ret) | |||
2375 | /* stop the trace while dumping */ | 2381 | /* stop the trace while dumping */ |
2376 | tracing_stop(); | 2382 | tracing_stop(); |
2377 | 2383 | ||
2378 | if (iter->trace && iter->trace->open) | ||
2379 | iter->trace->open(iter); | ||
2380 | |||
2381 | mutex_unlock(&trace_types_lock); | 2384 | mutex_unlock(&trace_types_lock); |
2382 | 2385 | ||
2383 | out: | 2386 | out: |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 28c15c2ebc22..717f9f045c6f 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -311,6 +311,7 @@ struct tracer { | |||
311 | int (*selftest)(struct tracer *trace, | 311 | int (*selftest)(struct tracer *trace, |
312 | struct trace_array *tr); | 312 | struct trace_array *tr); |
313 | #endif | 313 | #endif |
314 | void (*print_header)(struct seq_file *m); | ||
314 | enum print_line_t (*print_line)(struct trace_iterator *iter); | 315 | enum print_line_t (*print_line)(struct trace_iterator *iter); |
315 | /* If you handled the flag setting, return 0 */ | 316 | /* If you handled the flag setting, return 0 */ |
316 | int (*set_flag)(u32 old_flags, u32 bit, int set); | 317 | int (*set_flag)(u32 old_flags, u32 bit, int set); |