summaryrefslogtreecommitdiff
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-01-08 10:03:56 -0800
committerIngo Molnar <mingo@elte.hu>2009-01-11 04:00:44 +0100
commit034939b65ad5ff64b9709210b3469a95153c51a3 (patch)
tree14fc36bdcabc9c76ac179e4b39b7af11fcbdfb35 /kernel/trace/trace.h
parent67d347245f76a149c45bffb1a10145d31d61d1da (diff)
downloadlwn-034939b65ad5ff64b9709210b3469a95153c51a3.tar.gz
lwn-034939b65ad5ff64b9709210b3469a95153c51a3.zip
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 {
#define TRACER_OPT(s, b) .name = #s, .bit = b
/*
+ * If you want to provide a stat file (one-shot statistics), fill
+ * an iterator with stat_start/stat_next and a stat_show callbacks.
+ * The others callbacks are optional.
+ */
+struct tracer_stat {
+ /* The name of your stat file */
+ const char *name;
+ /* Iteration over statistic entries */
+ void *(*stat_start)(void);
+ void *(*stat_next)(void *prev, int idx);
+ /* Compare two entries for sorting (optional) for stats */
+ int (*stat_cmp)(void *p1, void *p2);
+ /* Print a stat entry */
+ int (*stat_show)(struct seq_file *s, void *p);
+ /* Print the headers of your stat entries */
+ int (*stat_headers)(struct seq_file *s);
+};
+
+/*
* A specific tracer, represented by methods that operate on a trace array:
*/
struct tracer {
@@ -361,21 +380,7 @@ struct tracer {
struct tracer *next;
int print_max;
struct tracer_flags *flags;
-
- /*
- * If you change one of the following on tracing runtime, recall
- * init_tracer_stat()
- */
-
- /* Iteration over statistic entries */
- void *(*stat_start)(void);
- void *(*stat_next)(void *prev, int idx);
- /* Compare two entries for sorting (optional) for stats */
- int (*stat_cmp)(void *p1, void *p2);
- /* Print a stat entry */
- int (*stat_show)(struct seq_file *s, void *p);
- /* Print the headers of your stat entries */
- int (*stat_headers)(struct seq_file *s);
+ struct tracer_stat *stats;
};
struct trace_seq {