summaryrefslogtreecommitdiff
path: root/tools/perf/util/stat-shadow.c
diff options
context:
space:
mode:
authorJin Yao <yao.jin@linux.intel.com>2017-12-01 13:57:28 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-12-05 16:24:31 +0300
commitb984aff7811bbac75b3f05931643d815067cf45c (patch)
tree7d6531dcbda282b4ffdc32990f0e63f0c5b73a5b /tools/perf/util/stat-shadow.c
parent33fec3e393dc1c55737cfb9c876b5c0da0d6f380 (diff)
downloadlinux-b984aff7811bbac75b3f05931643d815067cf45c.tar.xz
perf stat: Add rbtree node_delete op
In current stat-shadow.c, the rbtree deleting is ignored. The patch adds the implementation to node_delete method of rblist. Signed-off-by: Jin Yao <yao.jin@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Kan Liang <kan.liang@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1512125856-22056-5-git-send-email-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/stat-shadow.c')
-rw-r--r--tools/perf/util/stat-shadow.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 855e35cbb1dc..57ec22513971 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -87,6 +87,16 @@ static struct rb_node *saved_value_new(struct rblist *rblist __maybe_unused,
return &nd->rb_node;
}
+static void saved_value_delete(struct rblist *rblist __maybe_unused,
+ struct rb_node *rb_node)
+{
+ struct saved_value *v;
+
+ BUG_ON(!rb_node);
+ v = container_of(rb_node, struct saved_value, rb_node);
+ free(v);
+}
+
static struct saved_value *saved_value_lookup(struct perf_evsel *evsel,
int cpu,
bool create)
@@ -114,7 +124,7 @@ void perf_stat__init_shadow_stats(void)
rblist__init(&runtime_saved_values);
runtime_saved_values.node_cmp = saved_value_cmp;
runtime_saved_values.node_new = saved_value_new;
- /* No delete for now */
+ runtime_saved_values.node_delete = saved_value_delete;
}
static int evsel_context(struct perf_evsel *evsel)