summaryrefslogtreecommitdiff
path: root/tools/perf/util/symbol.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-03-07 16:50:06 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-03-08 11:30:44 -0300
commit9f87498f1cb72958c6f8725eb93d2f7ef81fa11e (patch)
treefacec74738cca821c7b7fc7c93c0f860cf74cc17 /tools/perf/util/symbol.h
parent915b4e27f1d32b3c7de4874ac1e3fe1f801151ca (diff)
perf tools: Add refcnt into struct mem_info
It's passed along several hists entries in --hierarchy mode, so it's better we keep track of it. The current fail I see is that it gets removed in hierarchy --mem-mode mode, where it's shared in the different hierarchies, but removed from the template hist entry, so the report crashes. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180307155020.32613-6-jolsa@kernel.org [ Rename mem_info__aloc() to mem_info__new(), to fix the typo and use the convention for constructors ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/symbol.h')
-rw-r--r--tools/perf/util/symbol.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0563f33c1eb3..70c16741f50a 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -200,9 +200,10 @@ struct branch_info {
};
struct mem_info {
- struct addr_map_symbol iaddr;
- struct addr_map_symbol daddr;
- union perf_mem_data_src data_src;
+ struct addr_map_symbol iaddr;
+ struct addr_map_symbol daddr;
+ union perf_mem_data_src data_src;
+ refcount_t refcnt;
};
struct addr_location {
@@ -389,4 +390,16 @@ int sdt_notes__get_count(struct list_head *start);
#define SDT_NOTE_NAME "stapsdt"
#define NR_ADDR 3
+struct mem_info *mem_info__new(void);
+struct mem_info *mem_info__get(struct mem_info *mi);
+void mem_info__put(struct mem_info *mi);
+
+static inline void __mem_info__zput(struct mem_info **mi)
+{
+ mem_info__put(*mi);
+ *mi = NULL;
+}
+
+#define mem_info__zput(mi) __mem_info__zput(&mi)
+
#endif /* __PERF_SYMBOL */