tracing/stat: add stat_release() callback
PATCH 1/2 tracing/stat: add stat_release() callback
From: Lai Jiangshan <[email protected]>
Add stat_release() callback to struct tracer_stat, so a stat tracer can release it's entries after the stat file has been read out.
Signed-off-by Lai Jiangshan <[email protected]>
Signed-off-by Li Zefan <[email protected]>
--- kernel/trace/trace_stat.c | 7 +++++-- kernel/trace/trace_stat.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-)
kernel/trace/trace_stat.c +5 -2
@@ -49,7 +49,8 @@ static struct dentry *stat_dir;* but it will at least advance closer to the next one * to be released. */ -static struct rb_node *release_next (struct rb_node *node) +static struct rb_node *release_next (struct tracer_stat *ts, +struct rb_node *node) {struct stat_node *snode;struct rb_node *parent =rb_parent (node);
@@ -67,6 +68,8 @@ static struct rb_node *release_next(struct rb_node *node) parent->rb_right =NULL ; snode = container_of(node, struct stat_node, node); +if (ts->stat_release) + ts->stat_release (snode->stat);kfree (snode);return parent;
@@ -78,7 +81,7 @@ static void reset_stat_session(struct stat_session *session)struct rb_node *node = session->stat_root.rb_node;while (node) - node =release_next (node); + node =release_next (session->ts, node); session->stat_root =RB_ROOT ; }
kernel/trace/trace_stat.h +2 -0
@@ -18,6 +18,8 @@ struct tracer_stat {int (*stat_cmp)(void *p1,void *p2);/* Print a stat entry */ int (*stat_show)(struct seq_file *s,void *p); +/* Release an entry */ +void (*stat_release)(void *stat);/* Print the headers of your stat entries */ int (*stat_headers)(struct seq_file *s); };
Signature · 1 line
1.5.4.rc3
[tip:tracing/core] tracing/stat: Add stat_release() callback
Commit-ID: d8ea37d5de58d35a39d0b4e7d209751aaa1b8174 Gitweb: http://git.kernel.org/tip/d8ea37d5de58d35a39d0b4e7d209751aaa1b8174 Author: Lai Jiangshan <[email protected]> AuthorDate: Mon, 6 Jul 2009 16:10:18 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 10 Jul 2009 12:14:05 +0200
tracing/stat: Add stat_release() callback
Add stat_release() callback to struct tracer_stat, so a stat tracer can release it's entries after the stat file has been read out.
Signed-off-by Lai Jiangshan <[email protected]>
Signed-off-by Li Zefan <[email protected]>
Cc Lai Jiangshan <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- kernel/trace/trace_stat.c | 7 +++++-- kernel/trace/trace_stat.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-)
kernel/trace/trace_stat.c +5 -2
@@ -49,7 +49,8 @@ static struct dentry *stat_dir;* but it will at least advance closer to the next one * to be released. */ -static struct rb_node *release_next (struct rb_node *node) +static struct rb_node *release_next (struct tracer_stat *ts, +struct rb_node *node) {struct stat_node *snode;struct rb_node *parent =rb_parent (node);
@@ -67,6 +68,8 @@ static struct rb_node *release_next(struct rb_node *node) parent->rb_right =NULL ; snode = container_of(node, struct stat_node, node); +if (ts->stat_release) + ts->stat_release (snode->stat);kfree (snode);return parent;
@@ -78,7 +81,7 @@ static void reset_stat_session(struct stat_session *session)struct rb_node *node = session->stat_root.rb_node;while (node) - node =release_next (node); + node =release_next (session->ts, node); session->stat_root =RB_ROOT ; }
kernel/trace/trace_stat.h +2 -0
@@ -18,6 +18,8 @@ struct tracer_stat {int (*stat_cmp)(void *p1,void *p2);/* Print a stat entry */ int (*stat_show)(struct seq_file *s,void *p); +/* Release an entry */ +void (*stat_release)(void *stat);/* Print the headers of your stat entries */ int (*stat_headers)(struct seq_file *s); };