aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-01-08 13:03:56 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-10 22:00:44 -0500
commit034939b65ad5ff64b9709210b3469a95153c51a3 (patch)
tree14fc36bdcabc9c76ac179e4b39b7af11fcbdfb35 /kernel/trace/trace.h
parent67d347245f76a149c45bffb1a10145d31d61d1da (diff)
tracing/ftrace: handle more than one stat file per tracer
Impact: new API for tracers Make the stat tracing API reentrant. And also provide the new directory /debugfs/tracing/trace_stat which will contain all the stat files for the current active tracer. Now a tracer will, if desired, want to provide a zero terminated array of tracer_stat structures. Each one contains the callbacks necessary for one stat file. It have to provide at least a name for its stat file, an iterator with stat_start/start_next callback and an output callback for one stat entry. Also adapt the branch tracer to this new API. We create two files "all" and "annotated" inside the /debugfs/tracing/trace_stat directory, making the both stats simultaneously available instead of needing to change an option to switch from one stat file to another. The output of these stats haven't changed. Changes in v2: _ Apply the previous memory leak fix (rebase against tip/master) Changes in v3: _ Merge the patch that adapted the branch tracer to this Api in this patch to not break the kernel build. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h35
1 files changed, 20 insertions, 15 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 94ed45e93a80..b3f9ad1b4d84 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -335,6 +335,25 @@ struct tracer_flags {
335#define TRACER_OPT(s, b) .name = #s, .bit = b 335#define TRACER_OPT(s, b) .name = #s, .bit = b
336 336
337/* 337/*
338 * If you want to provide a stat file (one-shot statistics), fill
339 * an iterator with stat_start/stat_next and a stat_show callbacks.
340 * The others callbacks are optional.
341 */
342struct tracer_stat {
343 /* The name of your stat file */
344 const char *name;
345 /* Iteration over statistic entries */
346 void *(*stat_start)(void);
347 void *(*stat_next)(void *prev, int idx);
348 /* Compare two entries for sorting (optional) for stats */
349 int (*stat_cmp)(void *p1, void *p2);
350 /* Print a stat entry */
351 int (*stat_show)(struct seq_file *s, void *p);
352 /* Print the headers of your stat entries */
353 int (*stat_headers)(struct seq_file *s);
354};
355
356/*
338 * A specific tracer, represented by methods that operate on a trace array: 357 * A specific tracer, represented by methods that operate on a trace array:
339 */ 358 */
340struct tracer { 359struct tracer {
@@ -361,21 +380,7 @@ struct tracer {
361 struct tracer *next; 380 struct tracer *next;
362 int print_max; 381 int print_max;
363 struct tracer_flags *flags; 382 struct tracer_flags *flags;
364 383 struct tracer_stat *stats;
365 /*
366 * If you change one of the following on tracing runtime, recall
367 * init_tracer_stat()
368 */
369
370 /* Iteration over statistic entries */
371 void *(*stat_start)(void);
372 void *(*stat_next)(void *prev, int idx);
373 /* Compare two entries for sorting (optional) for stats */
374 int (*stat_cmp)(void *p1, void *p2);
375 /* Print a stat entry */
376 int (*stat_show)(struct seq_file *s, void *p);
377 /* Print the headers of your stat entries */
378 int (*stat_headers)(struct seq_file *s);
379}; 384};
380 385
381struct trace_seq { 386struct trace_seq {