aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-11-05 13:32:36 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-05 13:32:36 -0500
commit316c7136f8bad924609163b9b115f68d59a68c82 (patch)
treeba664f98d92563544aa63dfb63ae4b49c27929c6 /tools
parent714647bdc516330e4405b39677d7f763e016c685 (diff)
perf tools: Finish the removal of 'self' arguments
They convey no information, perhaps I was bitten by some snake at some point, complete the detox by naming the last of those arguments more sensibly. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-u1r0dnjoro08dgztiy2g3t2q@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/scripts/python/Perf-Trace-Util/Context.c6
-rw-r--r--tools/perf/ui/browser.h32
-rw-r--r--tools/perf/ui/browsers/hists.c2
-rw-r--r--tools/perf/ui/browsers/map.c40
-rw-r--r--tools/perf/ui/browsers/map.h2
-rw-r--r--tools/perf/ui/browsers/scripts.c8
-rw-r--r--tools/perf/ui/stdio/hist.c14
-rw-r--r--tools/perf/util/build-id.h3
-rw-r--r--tools/perf/util/event.c6
-rw-r--r--tools/perf/util/event.h3
-rw-r--r--tools/perf/util/evlist.h2
-rw-r--r--tools/perf/util/hist.h33
-rw-r--r--tools/perf/util/probe-finder.c113
-rw-r--r--tools/perf/util/probe-finder.h10
-rw-r--r--tools/perf/util/pstack.h10
-rw-r--r--tools/perf/util/session.c121
-rw-r--r--tools/perf/util/session.h27
-rw-r--r--tools/perf/util/sort.h2
-rw-r--r--tools/perf/util/strfilter.c32
-rw-r--r--tools/perf/util/strfilter.h12
-rw-r--r--tools/perf/util/thread.h10
21 files changed, 242 insertions, 246 deletions
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
index 315067b8f552..fcd1dd667906 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/Context.c
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
@@ -25,7 +25,7 @@
25 25
26PyMODINIT_FUNC initperf_trace_context(void); 26PyMODINIT_FUNC initperf_trace_context(void);
27 27
28static PyObject *perf_trace_context_common_pc(PyObject *self, PyObject *args) 28static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args)
29{ 29{
30 static struct scripting_context *scripting_context; 30 static struct scripting_context *scripting_context;
31 PyObject *context; 31 PyObject *context;
@@ -40,7 +40,7 @@ static PyObject *perf_trace_context_common_pc(PyObject *self, PyObject *args)
40 return Py_BuildValue("i", retval); 40 return Py_BuildValue("i", retval);
41} 41}
42 42
43static PyObject *perf_trace_context_common_flags(PyObject *self, 43static PyObject *perf_trace_context_common_flags(PyObject *obj,
44 PyObject *args) 44 PyObject *args)
45{ 45{
46 static struct scripting_context *scripting_context; 46 static struct scripting_context *scripting_context;
@@ -56,7 +56,7 @@ static PyObject *perf_trace_context_common_flags(PyObject *self,
56 return Py_BuildValue("i", retval); 56 return Py_BuildValue("i", retval);
57} 57}
58 58
59static PyObject *perf_trace_context_common_lock_depth(PyObject *self, 59static PyObject *perf_trace_context_common_lock_depth(PyObject *obj,
60 PyObject *args) 60 PyObject *args)
61{ 61{
62 static struct scripting_context *scripting_context; 62 static struct scripting_context *scripting_context;
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h
index 404ff66a3e36..7d45d2f53601 100644
--- a/tools/perf/ui/browser.h
+++ b/tools/perf/ui/browser.h
@@ -21,32 +21,32 @@ struct ui_browser {
21 void *priv; 21 void *priv;
22 const char *title; 22 const char *title;
23 char *helpline; 23 char *helpline;
24 unsigned int (*refresh)(struct ui_browser *self); 24 unsigned int (*refresh)(struct ui_browser *browser);
25 void (*write)(struct ui_browser *self, void *entry, int row); 25 void (*write)(struct ui_browser *browser, void *entry, int row);
26 void (*seek)(struct ui_browser *self, off_t offset, int whence); 26 void (*seek)(struct ui_browser *browser, off_t offset, int whence);
27 bool (*filter)(struct ui_browser *self, void *entry); 27 bool (*filter)(struct ui_browser *browser, void *entry);
28 u32 nr_entries; 28 u32 nr_entries;
29 bool navkeypressed; 29 bool navkeypressed;
30 bool use_navkeypressed; 30 bool use_navkeypressed;
31}; 31};
32 32
33int ui_browser__set_color(struct ui_browser *browser, int color); 33int ui_browser__set_color(struct ui_browser *browser, int color);
34void ui_browser__set_percent_color(struct ui_browser *self, 34void ui_browser__set_percent_color(struct ui_browser *browser,
35 double percent, bool current); 35 double percent, bool current);
36bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row); 36bool ui_browser__is_current_entry(struct ui_browser *browser, unsigned row);
37void ui_browser__refresh_dimensions(struct ui_browser *self); 37void ui_browser__refresh_dimensions(struct ui_browser *browser);
38void ui_browser__reset_index(struct ui_browser *self); 38void ui_browser__reset_index(struct ui_browser *browser);
39 39
40void ui_browser__gotorc(struct ui_browser *self, int y, int x); 40void ui_browser__gotorc(struct ui_browser *browser, int y, int x);
41void ui_browser__write_graph(struct ui_browser *browser, int graph); 41void ui_browser__write_graph(struct ui_browser *browser, int graph);
42void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, 42void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
43 u64 start, u64 end); 43 u64 start, u64 end);
44void __ui_browser__show_title(struct ui_browser *browser, const char *title); 44void __ui_browser__show_title(struct ui_browser *browser, const char *title);
45void ui_browser__show_title(struct ui_browser *browser, const char *title); 45void ui_browser__show_title(struct ui_browser *browser, const char *title);
46int ui_browser__show(struct ui_browser *self, const char *title, 46int ui_browser__show(struct ui_browser *browser, const char *title,
47 const char *helpline, ...); 47 const char *helpline, ...);
48void ui_browser__hide(struct ui_browser *self); 48void ui_browser__hide(struct ui_browser *browser);
49int ui_browser__refresh(struct ui_browser *self); 49int ui_browser__refresh(struct ui_browser *browser);
50int ui_browser__run(struct ui_browser *browser, int delay_secs); 50int ui_browser__run(struct ui_browser *browser, int delay_secs);
51void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries); 51void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries);
52void ui_browser__handle_resize(struct ui_browser *browser); 52void ui_browser__handle_resize(struct ui_browser *browser);
@@ -63,11 +63,11 @@ int ui_browser__input_window(const char *title, const char *text, char *input,
63void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence); 63void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence);
64unsigned int ui_browser__argv_refresh(struct ui_browser *browser); 64unsigned int ui_browser__argv_refresh(struct ui_browser *browser);
65 65
66void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence); 66void ui_browser__rb_tree_seek(struct ui_browser *browser, off_t offset, int whence);
67unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self); 67unsigned int ui_browser__rb_tree_refresh(struct ui_browser *browser);
68 68
69void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence); 69void ui_browser__list_head_seek(struct ui_browser *browser, off_t offset, int whence);
70unsigned int ui_browser__list_head_refresh(struct ui_browser *self); 70unsigned int ui_browser__list_head_refresh(struct ui_browser *browser);
71 71
72void ui_browser__init(void); 72void ui_browser__init(void);
73void annotate_browser__init(void); 73void annotate_browser__init(void);
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a91b6b219412..16848bb4c418 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1889,7 +1889,7 @@ out:
1889 return key; 1889 return key;
1890} 1890}
1891 1891
1892static bool filter_group_entries(struct ui_browser *self __maybe_unused, 1892static bool filter_group_entries(struct ui_browser *browser __maybe_unused,
1893 void *entry) 1893 void *entry)
1894{ 1894{
1895 struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); 1895 struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node);
diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c
index 95c7cfb8f2c6..b11639f33682 100644
--- a/tools/perf/ui/browsers/map.c
+++ b/tools/perf/ui/browsers/map.c
@@ -18,30 +18,30 @@ struct map_browser {
18 u8 addrlen; 18 u8 addrlen;
19}; 19};
20 20
21static void map_browser__write(struct ui_browser *self, void *nd, int row) 21static void map_browser__write(struct ui_browser *browser, void *nd, int row)
22{ 22{
23 struct symbol *sym = rb_entry(nd, struct symbol, rb_node); 23 struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
24 struct map_browser *mb = container_of(self, struct map_browser, b); 24 struct map_browser *mb = container_of(browser, struct map_browser, b);
25 bool current_entry = ui_browser__is_current_entry(self, row); 25 bool current_entry = ui_browser__is_current_entry(browser, row);
26 int width; 26 int width;
27 27
28 ui_browser__set_percent_color(self, 0, current_entry); 28 ui_browser__set_percent_color(browser, 0, current_entry);
29 slsmg_printf("%*" PRIx64 " %*" PRIx64 " %c ", 29 slsmg_printf("%*" PRIx64 " %*" PRIx64 " %c ",
30 mb->addrlen, sym->start, mb->addrlen, sym->end, 30 mb->addrlen, sym->start, mb->addrlen, sym->end,
31 sym->binding == STB_GLOBAL ? 'g' : 31 sym->binding == STB_GLOBAL ? 'g' :
32 sym->binding == STB_LOCAL ? 'l' : 'w'); 32 sym->binding == STB_LOCAL ? 'l' : 'w');
33 width = self->width - ((mb->addrlen * 2) + 4); 33 width = browser->width - ((mb->addrlen * 2) + 4);
34 if (width > 0) 34 if (width > 0)
35 slsmg_write_nstring(sym->name, width); 35 slsmg_write_nstring(sym->name, width);
36} 36}
37 37
38/* FIXME uber-kludgy, see comment on cmd_report... */ 38/* FIXME uber-kludgy, see comment on cmd_report... */
39static u32 *symbol__browser_index(struct symbol *self) 39static u32 *symbol__browser_index(struct symbol *browser)
40{ 40{
41 return ((void *)self) - sizeof(struct rb_node) - sizeof(u32); 41 return ((void *)browser) - sizeof(struct rb_node) - sizeof(u32);
42} 42}
43 43
44static int map_browser__search(struct map_browser *self) 44static int map_browser__search(struct map_browser *browser)
45{ 45{
46 char target[512]; 46 char target[512];
47 struct symbol *sym; 47 struct symbol *sym;
@@ -53,37 +53,37 @@ static int map_browser__search(struct map_browser *self)
53 53
54 if (target[0] == '0' && tolower(target[1]) == 'x') { 54 if (target[0] == '0' && tolower(target[1]) == 'x') {
55 u64 addr = strtoull(target, NULL, 16); 55 u64 addr = strtoull(target, NULL, 16);
56 sym = map__find_symbol(self->map, addr, NULL); 56 sym = map__find_symbol(browser->map, addr, NULL);
57 } else 57 } else
58 sym = map__find_symbol_by_name(self->map, target, NULL); 58 sym = map__find_symbol_by_name(browser->map, target, NULL);
59 59
60 if (sym != NULL) { 60 if (sym != NULL) {
61 u32 *idx = symbol__browser_index(sym); 61 u32 *idx = symbol__browser_index(sym);
62 62
63 self->b.top = &sym->rb_node; 63 browser->b.top = &sym->rb_node;
64 self->b.index = self->b.top_idx = *idx; 64 browser->b.index = browser->b.top_idx = *idx;
65 } else 65 } else
66 ui_helpline__fpush("%s not found!", target); 66 ui_helpline__fpush("%s not found!", target);
67 67
68 return 0; 68 return 0;
69} 69}
70 70
71static int map_browser__run(struct map_browser *self) 71static int map_browser__run(struct map_browser *browser)
72{ 72{
73 int key; 73 int key;
74 74
75 if (ui_browser__show(&self->b, self->map->dso->long_name, 75 if (ui_browser__show(&browser->b, browser->map->dso->long_name,
76 "Press <- or ESC to exit, %s / to search", 76 "Press <- or ESC to exit, %s / to search",
77 verbose ? "" : "restart with -v to use") < 0) 77 verbose ? "" : "restart with -v to use") < 0)
78 return -1; 78 return -1;
79 79
80 while (1) { 80 while (1) {
81 key = ui_browser__run(&self->b, 0); 81 key = ui_browser__run(&browser->b, 0);
82 82
83 switch (key) { 83 switch (key) {
84 case '/': 84 case '/':
85 if (verbose) 85 if (verbose)
86 map_browser__search(self); 86 map_browser__search(browser);
87 default: 87 default:
88 break; 88 break;
89 case K_LEFT: 89 case K_LEFT:
@@ -94,20 +94,20 @@ static int map_browser__run(struct map_browser *self)
94 } 94 }
95 } 95 }
96out: 96out:
97 ui_browser__hide(&self->b); 97 ui_browser__hide(&browser->b);
98 return key; 98 return key;
99} 99}
100 100
101int map__browse(struct map *self) 101int map__browse(struct map *map)
102{ 102{
103 struct map_browser mb = { 103 struct map_browser mb = {
104 .b = { 104 .b = {
105 .entries = &self->dso->symbols[self->type], 105 .entries = &map->dso->symbols[map->type],
106 .refresh = ui_browser__rb_tree_refresh, 106 .refresh = ui_browser__rb_tree_refresh,
107 .seek = ui_browser__rb_tree_seek, 107 .seek = ui_browser__rb_tree_seek,
108 .write = map_browser__write, 108 .write = map_browser__write,
109 }, 109 },
110 .map = self, 110 .map = map,
111 }; 111 };
112 struct rb_node *nd; 112 struct rb_node *nd;
113 char tmp[BITS_PER_LONG / 4]; 113 char tmp[BITS_PER_LONG / 4];
diff --git a/tools/perf/ui/browsers/map.h b/tools/perf/ui/browsers/map.h
index df8581a43e17..2d58e4b3eb6f 100644
--- a/tools/perf/ui/browsers/map.h
+++ b/tools/perf/ui/browsers/map.h
@@ -2,5 +2,5 @@
2#define _PERF_UI_MAP_BROWSER_H_ 1 2#define _PERF_UI_MAP_BROWSER_H_ 1
3struct map; 3struct map;
4 4
5int map__browse(struct map *self); 5int map__browse(struct map *map);
6#endif /* _PERF_UI_MAP_BROWSER_H_ */ 6#endif /* _PERF_UI_MAP_BROWSER_H_ */
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 12f009e61e94..d63c68ea02a8 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -84,22 +84,22 @@ static void script_browser__write(struct ui_browser *browser,
84 slsmg_write_nstring(sline->line, browser->width); 84 slsmg_write_nstring(sline->line, browser->width);
85} 85}
86 86
87static int script_browser__run(struct perf_script_browser *self) 87static int script_browser__run(struct perf_script_browser *browser)
88{ 88{
89 int key; 89 int key;
90 90
91 if (ui_browser__show(&self->b, self->script_name, 91 if (ui_browser__show(&browser->b, browser->script_name,
92 "Press <- or ESC to exit") < 0) 92 "Press <- or ESC to exit") < 0)
93 return -1; 93 return -1;
94 94
95 while (1) { 95 while (1) {
96 key = ui_browser__run(&self->b, 0); 96 key = ui_browser__run(&browser->b, 0);
97 97
98 /* We can add some special key handling here if needed */ 98 /* We can add some special key handling here if needed */
99 break; 99 break;
100 } 100 }
101 101
102 ui_browser__hide(&self->b); 102 ui_browser__hide(&browser->b);
103 return key; 103 return key;
104} 104}
105 105
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 6c152686e837..c244cb524ef2 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -213,20 +213,19 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
213 return ret; 213 return ret;
214} 214}
215 215
216static size_t __callchain__fprintf_flat(FILE *fp, 216static size_t __callchain__fprintf_flat(FILE *fp, struct callchain_node *node,
217 struct callchain_node *self,
218 u64 total_samples) 217 u64 total_samples)
219{ 218{
220 struct callchain_list *chain; 219 struct callchain_list *chain;
221 size_t ret = 0; 220 size_t ret = 0;
222 221
223 if (!self) 222 if (!node)
224 return 0; 223 return 0;
225 224
226 ret += __callchain__fprintf_flat(fp, self->parent, total_samples); 225 ret += __callchain__fprintf_flat(fp, node->parent, total_samples);
227 226
228 227
229 list_for_each_entry(chain, &self->val, list) { 228 list_for_each_entry(chain, &node->val, list) {
230 if (chain->ip >= PERF_CONTEXT_MAX) 229 if (chain->ip >= PERF_CONTEXT_MAX)
231 continue; 230 continue;
232 if (chain->ms.sym) 231 if (chain->ms.sym)
@@ -239,15 +238,14 @@ static size_t __callchain__fprintf_flat(FILE *fp,
239 return ret; 238 return ret;
240} 239}
241 240
242static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *self, 241static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *tree,
243 u64 total_samples) 242 u64 total_samples)
244{ 243{
245 size_t ret = 0; 244 size_t ret = 0;
246 u32 entries_printed = 0; 245 u32 entries_printed = 0;
247 struct rb_node *rb_node;
248 struct callchain_node *chain; 246 struct callchain_node *chain;
247 struct rb_node *rb_node = rb_first(tree);
249 248
250 rb_node = rb_first(self);
251 while (rb_node) { 249 while (rb_node) {
252 double percent; 250 double percent;
253 251
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index a811f5c62e18..929f28a7c14d 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -10,10 +10,9 @@ extern struct perf_tool build_id__mark_dso_hit_ops;
10struct dso; 10struct dso;
11 11
12int build_id__sprintf(const u8 *build_id, int len, char *bf); 12int build_id__sprintf(const u8 *build_id, int len, char *bf);
13char *dso__build_id_filename(struct dso *self, char *bf, size_t size); 13char *dso__build_id_filename(struct dso *dso, char *bf, size_t size);
14 14
15int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, 15int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
16 struct perf_sample *sample, struct perf_evsel *evsel, 16 struct perf_sample *sample, struct perf_evsel *evsel,
17 struct machine *machine); 17 struct machine *machine);
18
19#endif 18#endif
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index c26b3539187b..ec9ae1114ed4 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -617,15 +617,15 @@ int perf_event__process(struct perf_tool *tool __maybe_unused,
617 return machine__process_event(machine, event, sample); 617 return machine__process_event(machine, event, sample);
618} 618}
619 619
620void thread__find_addr_map(struct thread *self, 620void thread__find_addr_map(struct thread *thread,
621 struct machine *machine, u8 cpumode, 621 struct machine *machine, u8 cpumode,
622 enum map_type type, u64 addr, 622 enum map_type type, u64 addr,
623 struct addr_location *al) 623 struct addr_location *al)
624{ 624{
625 struct map_groups *mg = &self->mg; 625 struct map_groups *mg = &thread->mg;
626 bool load_map = false; 626 bool load_map = false;
627 627
628 al->thread = self; 628 al->thread = thread;
629 al->addr = addr; 629 al->addr = addr;
630 al->cpumode = cpumode; 630 al->cpumode = cpumode;
631 al->filtered = false; 631 al->filtered = false;
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 752709ccfb00..f8d70f3003ab 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -251,7 +251,8 @@ int perf_event__process(struct perf_tool *tool,
251 struct machine *machine); 251 struct machine *machine);
252 252
253struct addr_location; 253struct addr_location;
254int perf_event__preprocess_sample(const union perf_event *self, 254
255int perf_event__preprocess_sample(const union perf_event *event,
255 struct machine *machine, 256 struct machine *machine,
256 struct addr_location *al, 257 struct addr_location *al,
257 struct perf_sample *sample); 258 struct perf_sample *sample);
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 0617ce2a0679..e99eaed92682 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -88,7 +88,7 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
88 88
89struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id); 89struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
90 90
91union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); 91union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx);
92 92
93void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx); 93void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx);
94 94
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 307f1c742563..b621347a1585 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -84,7 +84,7 @@ struct hists {
84 u16 col_len[HISTC_NR_COLS]; 84 u16 col_len[HISTC_NR_COLS];
85}; 85};
86 86
87struct hist_entry *__hists__add_entry(struct hists *self, 87struct hist_entry *__hists__add_entry(struct hists *hists,
88 struct addr_location *al, 88 struct addr_location *al,
89 struct symbol *parent, 89 struct symbol *parent,
90 struct branch_info *bi, 90 struct branch_info *bi,
@@ -93,34 +93,34 @@ struct hist_entry *__hists__add_entry(struct hists *self,
93int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); 93int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right);
94int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); 94int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right);
95int hist_entry__transaction_len(void); 95int hist_entry__transaction_len(void);
96int hist_entry__sort_snprintf(struct hist_entry *self, char *bf, size_t size, 96int hist_entry__sort_snprintf(struct hist_entry *he, char *bf, size_t size,
97 struct hists *hists); 97 struct hists *hists);
98void hist_entry__free(struct hist_entry *); 98void hist_entry__free(struct hist_entry *);
99 99
100void hists__output_resort(struct hists *self); 100void hists__output_resort(struct hists *hists);
101void hists__collapse_resort(struct hists *self, struct ui_progress *prog); 101void hists__collapse_resort(struct hists *hists, struct ui_progress *prog);
102 102
103void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); 103void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel);
104void hists__output_recalc_col_len(struct hists *hists, int max_rows); 104void hists__output_recalc_col_len(struct hists *hists, int max_rows);
105 105
106void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h); 106void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h);
107void hists__inc_nr_events(struct hists *self, u32 type); 107void hists__inc_nr_events(struct hists *hists, u32 type);
108void events_stats__inc(struct events_stats *stats, u32 type); 108void events_stats__inc(struct events_stats *stats, u32 type);
109size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); 109size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
110 110
111size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, 111size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
112 int max_cols, float min_pcnt, FILE *fp); 112 int max_cols, float min_pcnt, FILE *fp);
113 113
114int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); 114int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr);
115int hist_entry__annotate(struct hist_entry *self, size_t privsize); 115int hist_entry__annotate(struct hist_entry *he, size_t privsize);
116 116
117void hists__filter_by_dso(struct hists *hists); 117void hists__filter_by_dso(struct hists *hists);
118void hists__filter_by_thread(struct hists *hists); 118void hists__filter_by_thread(struct hists *hists);
119void hists__filter_by_symbol(struct hists *hists); 119void hists__filter_by_symbol(struct hists *hists);
120 120
121u16 hists__col_len(struct hists *self, enum hist_column col); 121u16 hists__col_len(struct hists *hists, enum hist_column col);
122void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); 122void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len);
123bool hists__new_col_len(struct hists *self, enum hist_column col, u16 len); 123bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len);
124void hists__reset_col_len(struct hists *hists); 124void hists__reset_col_len(struct hists *hists);
125void hists__calc_col_len(struct hists *hists, struct hist_entry *he); 125void hists__calc_col_len(struct hists *hists, struct hist_entry *he);
126 126
@@ -210,12 +210,9 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
210 return 0; 210 return 0;
211} 211}
212 212
213static inline int hist_entry__tui_annotate(struct hist_entry *self 213static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused,
214 __maybe_unused, 214 struct perf_evsel *evsel __maybe_unused,
215 struct perf_evsel *evsel 215 struct hist_browser_timer *hbt __maybe_unused)
216 __maybe_unused,
217 struct hist_browser_timer *hbt
218 __maybe_unused)
219{ 216{
220 return 0; 217 return 0;
221} 218}
@@ -230,5 +227,5 @@ static inline int script_browse(const char *script_opt __maybe_unused)
230#define K_SWITCH_INPUT_DATA -3000 227#define K_SWITCH_INPUT_DATA -3000
231#endif 228#endif
232 229
233unsigned int hists__sort_list_width(struct hists *self); 230unsigned int hists__sort_list_width(struct hists *hists);
234#endif /* __PERF_HIST_H */ 231#endif /* __PERF_HIST_H */
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 2200dad4c3f4..ffb657ffd327 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -115,7 +115,7 @@ static const Dwfl_Callbacks offline_callbacks = {
115}; 115};
116 116
117/* Get a Dwarf from offline image */ 117/* Get a Dwarf from offline image */
118static int debuginfo__init_offline_dwarf(struct debuginfo *self, 118static int debuginfo__init_offline_dwarf(struct debuginfo *dbg,
119 const char *path) 119 const char *path)
120{ 120{
121 int fd; 121 int fd;
@@ -124,25 +124,25 @@ static int debuginfo__init_offline_dwarf(struct debuginfo *self,
124 if (fd < 0) 124 if (fd < 0)
125 return fd; 125 return fd;
126 126
127 self->dwfl = dwfl_begin(&offline_callbacks); 127 dbg->dwfl = dwfl_begin(&offline_callbacks);
128 if (!self->dwfl) 128 if (!dbg->dwfl)
129 goto error; 129 goto error;
130 130
131 self->mod = dwfl_report_offline(self->dwfl, "", "", fd); 131 dbg->mod = dwfl_report_offline(dbg->dwfl, "", "", fd);
132 if (!self->mod) 132 if (!dbg->mod)
133 goto error; 133 goto error;
134 134
135 self->dbg = dwfl_module_getdwarf(self->mod, &self->bias); 135 dbg->dbg = dwfl_module_getdwarf(dbg->mod, &dbg->bias);
136 if (!self->dbg) 136 if (!dbg->dbg)
137 goto error; 137 goto error;
138 138
139 return 0; 139 return 0;
140error: 140error:
141 if (self->dwfl) 141 if (dbg->dwfl)
142 dwfl_end(self->dwfl); 142 dwfl_end(dbg->dwfl);
143 else 143 else
144 close(fd); 144 close(fd);
145 memset(self, 0, sizeof(*self)); 145 memset(dbg, 0, sizeof(*dbg));
146 146
147 return -ENOENT; 147 return -ENOENT;
148} 148}
@@ -180,24 +180,24 @@ static const Dwfl_Callbacks kernel_callbacks = {
180}; 180};
181 181
182/* Get a Dwarf from live kernel image */ 182/* Get a Dwarf from live kernel image */
183static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self, 183static int debuginfo__init_online_kernel_dwarf(struct debuginfo *dbg,
184 Dwarf_Addr addr) 184 Dwarf_Addr addr)
185{ 185{
186 self->dwfl = dwfl_begin(&kernel_callbacks); 186 dbg->dwfl = dwfl_begin(&kernel_callbacks);
187 if (!self->dwfl) 187 if (!dbg->dwfl)
188 return -EINVAL; 188 return -EINVAL;
189 189
190 /* Load the kernel dwarves: Don't care the result here */ 190 /* Load the kernel dwarves: Don't care the result here */
191 dwfl_linux_kernel_report_kernel(self->dwfl); 191 dwfl_linux_kernel_report_kernel(dbg->dwfl);
192 dwfl_linux_kernel_report_modules(self->dwfl); 192 dwfl_linux_kernel_report_modules(dbg->dwfl);
193 193
194 self->dbg = dwfl_addrdwarf(self->dwfl, addr, &self->bias); 194 dbg->dbg = dwfl_addrdwarf(dbg->dwfl, addr, &dbg->bias);
195 /* Here, check whether we could get a real dwarf */ 195 /* Here, check whether we could get a real dwarf */
196 if (!self->dbg) { 196 if (!dbg->dbg) {
197 pr_debug("Failed to find kernel dwarf at %lx\n", 197 pr_debug("Failed to find kernel dwarf at %lx\n",
198 (unsigned long)addr); 198 (unsigned long)addr);
199 dwfl_end(self->dwfl); 199 dwfl_end(dbg->dwfl);
200 memset(self, 0, sizeof(*self)); 200 memset(dbg, 0, sizeof(*dbg));
201 return -ENOENT; 201 return -ENOENT;
202 } 202 }
203 203
@@ -205,7 +205,7 @@ static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self,
205} 205}
206#else 206#else
207/* With older elfutils, this just support kernel module... */ 207/* With older elfutils, this just support kernel module... */
208static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self, 208static int debuginfo__init_online_kernel_dwarf(struct debuginfo *dbg,
209 Dwarf_Addr addr __maybe_unused) 209 Dwarf_Addr addr __maybe_unused)
210{ 210{
211 const char *path = kernel_get_module_path("kernel"); 211 const char *path = kernel_get_module_path("kernel");
@@ -216,44 +216,45 @@ static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self,
216 } 216 }
217 217
218 pr_debug2("Use file %s for debuginfo\n", path); 218 pr_debug2("Use file %s for debuginfo\n", path);
219 return debuginfo__init_offline_dwarf(self, path); 219 return debuginfo__init_offline_dwarf(dbg, path);
220} 220}
221#endif 221#endif
222 222
223struct debuginfo *debuginfo__new(const char *path) 223struct debuginfo *debuginfo__new(const char *path)
224{ 224{
225 struct debuginfo *self = zalloc(sizeof(struct debuginfo)); 225 struct debuginfo *dbg = zalloc(sizeof(*dbg));
226 if (!self) 226 if (!dbg)
227 return NULL; 227 return NULL;
228 228
229 if (debuginfo__init_offline_dwarf(self, path) < 0) { 229 if (debuginfo__init_offline_dwarf(dbg, path) < 0) {
230 free(self); 230 free(dbg);
231 self = NULL; 231 dbg = NULL;
232 } 232 }
233 233
234 return self; 234 return dbg;
235} 235}
236 236
237struct debuginfo *debuginfo__new_online_kernel(unsigned long addr) 237struct debuginfo *debuginfo__new_online_kernel(unsigned long addr)
238{ 238{
239 struct debuginfo *self = zalloc(sizeof(struct debuginfo)); 239 struct debuginfo *dbg = zalloc(sizeof(*dbg));
240 if (!self) 240
241 if (!dbg)
241 return NULL; 242 return NULL;
242 243
243 if (debuginfo__init_online_kernel_dwarf(self, (Dwarf_Addr)addr) < 0) { 244 if (debuginfo__init_online_kernel_dwarf(dbg, (Dwarf_Addr)addr) < 0) {
244 free(self); 245 free(dbg);
245 self = NULL; 246 dbg = NULL;
246 } 247 }
247 248
248 return self; 249 return dbg;
249} 250}
250 251
251void debuginfo__delete(struct debuginfo *self) 252void debuginfo__delete(struct debuginfo *dbg)
252{ 253{
253 if (self) { 254 if (dbg) {
254 if (self->dwfl) 255 if (dbg->dwfl)
255 dwfl_end(self->dwfl); 256 dwfl_end(dbg->dwfl);
256 free(self); 257 free(dbg);
257 } 258 }
258} 259}
259 260
@@ -1083,7 +1084,7 @@ static int pubname_search_cb(Dwarf *dbg, Dwarf_Global *gl, void *data)
1083} 1084}
1084 1085
1085/* Find probe points from debuginfo */ 1086/* Find probe points from debuginfo */
1086static int debuginfo__find_probes(struct debuginfo *self, 1087static int debuginfo__find_probes(struct debuginfo *dbg,
1087 struct probe_finder *pf) 1088 struct probe_finder *pf)
1088{ 1089{
1089 struct perf_probe_point *pp = &pf->pev->point; 1090 struct perf_probe_point *pp = &pf->pev->point;
@@ -1094,7 +1095,7 @@ static int debuginfo__find_probes(struct debuginfo *self,
1094 1095
1095#if _ELFUTILS_PREREQ(0, 142) 1096#if _ELFUTILS_PREREQ(0, 142)
1096 /* Get the call frame information from this dwarf */ 1097 /* Get the call frame information from this dwarf */
1097 pf->cfi = dwarf_getcfi(self->dbg); 1098 pf->cfi = dwarf_getcfi(dbg->dbg);
1098#endif 1099#endif
1099 1100
1100 off = 0; 1101 off = 0;
@@ -1113,7 +1114,7 @@ static int debuginfo__find_probes(struct debuginfo *self,
1113 .data = pf, 1114 .data = pf,
1114 }; 1115 };
1115 1116
1116 dwarf_getpubnames(self->dbg, pubname_search_cb, 1117 dwarf_getpubnames(dbg->dbg, pubname_search_cb,
1117 &pubname_param, 0); 1118 &pubname_param, 0);
1118 if (pubname_param.found) { 1119 if (pubname_param.found) {
1119 ret = probe_point_search_cb(&pf->sp_die, &probe_param); 1120 ret = probe_point_search_cb(&pf->sp_die, &probe_param);
@@ -1123,9 +1124,9 @@ static int debuginfo__find_probes(struct debuginfo *self,
1123 } 1124 }
1124 1125
1125 /* Loop on CUs (Compilation Unit) */ 1126 /* Loop on CUs (Compilation Unit) */
1126 while (!dwarf_nextcu(self->dbg, off, &noff, &cuhl, NULL, NULL, NULL)) { 1127 while (!dwarf_nextcu(dbg->dbg, off, &noff, &cuhl, NULL, NULL, NULL)) {
1127 /* Get the DIE(Debugging Information Entry) of this CU */ 1128 /* Get the DIE(Debugging Information Entry) of this CU */
1128 diep = dwarf_offdie(self->dbg, off + cuhl, &pf->cu_die); 1129 diep = dwarf_offdie(dbg->dbg, off + cuhl, &pf->cu_die);
1129 if (!diep) 1130 if (!diep)
1130 continue; 1131 continue;
1131 1132
@@ -1281,13 +1282,13 @@ end:
1281} 1282}
1282 1283
1283/* Find probe_trace_events specified by perf_probe_event from debuginfo */ 1284/* Find probe_trace_events specified by perf_probe_event from debuginfo */
1284int debuginfo__find_trace_events(struct debuginfo *self, 1285int debuginfo__find_trace_events(struct debuginfo *dbg,
1285 struct perf_probe_event *pev, 1286 struct perf_probe_event *pev,
1286 struct probe_trace_event **tevs, int max_tevs) 1287 struct probe_trace_event **tevs, int max_tevs)
1287{ 1288{
1288 struct trace_event_finder tf = { 1289 struct trace_event_finder tf = {
1289 .pf = {.pev = pev, .callback = add_probe_trace_event}, 1290 .pf = {.pev = pev, .callback = add_probe_trace_event},
1290 .mod = self->mod, .max_tevs = max_tevs}; 1291 .mod = dbg->mod, .max_tevs = max_tevs};
1291 int ret; 1292 int ret;
1292 1293
1293 /* Allocate result tevs array */ 1294 /* Allocate result tevs array */
@@ -1298,7 +1299,7 @@ int debuginfo__find_trace_events(struct debuginfo *self,
1298 tf.tevs = *tevs; 1299 tf.tevs = *tevs;
1299 tf.ntevs = 0; 1300 tf.ntevs = 0;
1300 1301
1301 ret = debuginfo__find_probes(self, &tf.pf); 1302 ret = debuginfo__find_probes(dbg, &tf.pf);
1302 if (ret < 0) { 1303 if (ret < 0) {
1303 free(*tevs); 1304 free(*tevs);
1304 *tevs = NULL; 1305 *tevs = NULL;
@@ -1389,14 +1390,14 @@ out:
1389} 1390}
1390 1391
1391/* Find available variables at given probe point */ 1392/* Find available variables at given probe point */
1392int debuginfo__find_available_vars_at(struct debuginfo *self, 1393int debuginfo__find_available_vars_at(struct debuginfo *dbg,
1393 struct perf_probe_event *pev, 1394 struct perf_probe_event *pev,
1394 struct variable_list **vls, 1395 struct variable_list **vls,
1395 int max_vls, bool externs) 1396 int max_vls, bool externs)
1396{ 1397{
1397 struct available_var_finder af = { 1398 struct available_var_finder af = {
1398 .pf = {.pev = pev, .callback = add_available_vars}, 1399 .pf = {.pev = pev, .callback = add_available_vars},
1399 .mod = self->mod, 1400 .mod = dbg->mod,
1400 .max_vls = max_vls, .externs = externs}; 1401 .max_vls = max_vls, .externs = externs};
1401 int ret; 1402 int ret;
1402 1403
@@ -1408,7 +1409,7 @@ int debuginfo__find_available_vars_at(struct debuginfo *self,
1408 af.vls = *vls; 1409 af.vls = *vls;
1409 af.nvls = 0; 1410 af.nvls = 0;
1410 1411
1411 ret = debuginfo__find_probes(self, &af.pf); 1412 ret = debuginfo__find_probes(dbg, &af.pf);
1412 if (ret < 0) { 1413 if (ret < 0) {
1413 /* Free vlist for error */ 1414 /* Free vlist for error */
1414 while (af.nvls--) { 1415 while (af.nvls--) {
@@ -1426,7 +1427,7 @@ int debuginfo__find_available_vars_at(struct debuginfo *self,
1426} 1427}
1427 1428
1428/* Reverse search */ 1429/* Reverse search */
1429int debuginfo__find_probe_point(struct debuginfo *self, unsigned long addr, 1430int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,
1430 struct perf_probe_point *ppt) 1431 struct perf_probe_point *ppt)
1431{ 1432{
1432 Dwarf_Die cudie, spdie, indie; 1433 Dwarf_Die cudie, spdie, indie;
@@ -1435,10 +1436,10 @@ int debuginfo__find_probe_point(struct debuginfo *self, unsigned long addr,
1435 int baseline = 0, lineno = 0, ret = 0; 1436 int baseline = 0, lineno = 0, ret = 0;
1436 1437
1437 /* Adjust address with bias */ 1438 /* Adjust address with bias */
1438 addr += self->bias; 1439 addr += dbg->bias;
1439 1440
1440 /* Find cu die */ 1441 /* Find cu die */
1441 if (!dwarf_addrdie(self->dbg, (Dwarf_Addr)addr - self->bias, &cudie)) { 1442 if (!dwarf_addrdie(dbg->dbg, (Dwarf_Addr)addr - dbg->bias, &cudie)) {
1442 pr_warning("Failed to find debug information for address %lx\n", 1443 pr_warning("Failed to find debug information for address %lx\n",
1443 addr); 1444 addr);
1444 ret = -EINVAL; 1445 ret = -EINVAL;
@@ -1639,7 +1640,7 @@ static int find_line_range_by_func(struct line_finder *lf)
1639 return param.retval; 1640 return param.retval;
1640} 1641}
1641 1642
1642int debuginfo__find_line_range(struct debuginfo *self, struct line_range *lr) 1643int debuginfo__find_line_range(struct debuginfo *dbg, struct line_range *lr)
1643{ 1644{
1644 struct line_finder lf = {.lr = lr, .found = 0}; 1645 struct line_finder lf = {.lr = lr, .found = 0};
1645 int ret = 0; 1646 int ret = 0;
@@ -1656,7 +1657,7 @@ int debuginfo__find_line_range(struct debuginfo *self, struct line_range *lr)
1656 struct dwarf_callback_param line_range_param = { 1657 struct dwarf_callback_param line_range_param = {
1657 .data = (void *)&lf, .retval = 0}; 1658 .data = (void *)&lf, .retval = 0};
1658 1659
1659 dwarf_getpubnames(self->dbg, pubname_search_cb, 1660 dwarf_getpubnames(dbg->dbg, pubname_search_cb,
1660 &pubname_param, 0); 1661 &pubname_param, 0);
1661 if (pubname_param.found) { 1662 if (pubname_param.found) {
1662 line_range_search_cb(&lf.sp_die, &line_range_param); 1663 line_range_search_cb(&lf.sp_die, &line_range_param);
@@ -1667,12 +1668,12 @@ int debuginfo__find_line_range(struct debuginfo *self, struct line_range *lr)
1667 1668
1668 /* Loop on CUs (Compilation Unit) */ 1669 /* Loop on CUs (Compilation Unit) */
1669 while (!lf.found && ret >= 0) { 1670 while (!lf.found && ret >= 0) {
1670 if (dwarf_nextcu(self->dbg, off, &noff, &cuhl, 1671 if (dwarf_nextcu(dbg->dbg, off, &noff, &cuhl,
1671 NULL, NULL, NULL) != 0) 1672 NULL, NULL, NULL) != 0)
1672 break; 1673 break;
1673 1674
1674 /* Get the DIE(Debugging Information Entry) of this CU */ 1675 /* Get the DIE(Debugging Information Entry) of this CU */
1675 diep = dwarf_offdie(self->dbg, off + cuhl, &lf.cu_die); 1676 diep = dwarf_offdie(dbg->dbg, off + cuhl, &lf.cu_die);
1676 if (!diep) 1677 if (!diep)
1677 continue; 1678 continue;
1678 1679
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index d6dab0e0a937..ffc33cdd25cc 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -31,25 +31,25 @@ struct debuginfo {
31 31
32extern struct debuginfo *debuginfo__new(const char *path); 32extern struct debuginfo *debuginfo__new(const char *path);
33extern struct debuginfo *debuginfo__new_online_kernel(unsigned long addr); 33extern struct debuginfo *debuginfo__new_online_kernel(unsigned long addr);
34extern void debuginfo__delete(struct debuginfo *self); 34extern void debuginfo__delete(struct debuginfo *dbg);
35 35
36/* Find probe_trace_events specified by perf_probe_event from debuginfo */ 36/* Find probe_trace_events specified by perf_probe_event from debuginfo */
37extern int debuginfo__find_trace_events(struct debuginfo *self, 37extern int debuginfo__find_trace_events(struct debuginfo *dbg,
38 struct perf_probe_event *pev, 38 struct perf_probe_event *pev,
39 struct probe_trace_event **tevs, 39 struct probe_trace_event **tevs,
40 int max_tevs); 40 int max_tevs);
41 41
42/* Find a perf_probe_point from debuginfo */ 42/* Find a perf_probe_point from debuginfo */
43extern int debuginfo__find_probe_point(struct debuginfo *self, 43extern int debuginfo__find_probe_point(struct debuginfo *dbg,
44 unsigned long addr, 44 unsigned long addr,
45 struct perf_probe_point *ppt); 45 struct perf_probe_point *ppt);
46 46
47/* Find a line range */ 47/* Find a line range */
48extern int debuginfo__find_line_range(struct debuginfo *self, 48extern int debuginfo__find_line_range(struct debuginfo *dbg,
49 struct line_range *lr); 49 struct line_range *lr);
50 50
51/* Find available variables */ 51/* Find available variables */
52extern int debuginfo__find_available_vars_at(struct debuginfo *self, 52extern int debuginfo__find_available_vars_at(struct debuginfo *dbg,
53 struct perf_probe_event *pev, 53 struct perf_probe_event *pev,
54 struct variable_list **vls, 54 struct variable_list **vls,
55 int max_points, bool externs); 55 int max_points, bool externs);
diff --git a/tools/perf/util/pstack.h b/tools/perf/util/pstack.h
index 4cedea59f518..c3cb6584d527 100644
--- a/tools/perf/util/pstack.h
+++ b/tools/perf/util/pstack.h
@@ -5,10 +5,10 @@
5 5
6struct pstack; 6struct pstack;
7struct pstack *pstack__new(unsigned short max_nr_entries); 7struct pstack *pstack__new(unsigned short max_nr_entries);
8void pstack__delete(struct pstack *self); 8void pstack__delete(struct pstack *pstack);
9bool pstack__empty(const struct pstack *self); 9bool pstack__empty(const struct pstack *pstack);
10void pstack__remove(struct pstack *self, void *key); 10void pstack__remove(struct pstack *pstack, void *key);
11void pstack__push(struct pstack *self, void *key); 11void pstack__push(struct pstack *pstack, void *key);
12void *pstack__pop(struct pstack *self); 12void *pstack__pop(struct pstack *pstack);
13 13
14#endif /* _PERF_PSTACK_ */ 14#endif /* _PERF_PSTACK_ */
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 3c1b30103d54..0ce46943d627 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -16,11 +16,11 @@
16#include "perf_regs.h" 16#include "perf_regs.h"
17#include "vdso.h" 17#include "vdso.h"
18 18
19static int perf_session__open(struct perf_session *self) 19static int perf_session__open(struct perf_session *session)
20{ 20{
21 struct perf_data_file *file = self->file; 21 struct perf_data_file *file = session->file;
22 22
23 if (perf_session__read_header(self) < 0) { 23 if (perf_session__read_header(session) < 0) {
24 pr_err("incompatible file format (rerun with -v to learn more)"); 24 pr_err("incompatible file format (rerun with -v to learn more)");
25 return -1; 25 return -1;
26 } 26 }
@@ -28,17 +28,17 @@ static int perf_session__open(struct perf_session *self)
28 if (perf_data_file__is_pipe(file)) 28 if (perf_data_file__is_pipe(file))
29 return 0; 29 return 0;
30 30
31 if (!perf_evlist__valid_sample_type(self->evlist)) { 31 if (!perf_evlist__valid_sample_type(session->evlist)) {
32 pr_err("non matching sample_type"); 32 pr_err("non matching sample_type");
33 return -1; 33 return -1;
34 } 34 }
35 35
36 if (!perf_evlist__valid_sample_id_all(self->evlist)) { 36 if (!perf_evlist__valid_sample_id_all(session->evlist)) {
37 pr_err("non matching sample_id_all"); 37 pr_err("non matching sample_id_all");
38 return -1; 38 return -1;
39 } 39 }
40 40
41 if (!perf_evlist__valid_read_format(self->evlist)) { 41 if (!perf_evlist__valid_read_format(session->evlist)) {
42 pr_err("non matching read_format"); 42 pr_err("non matching read_format");
43 return -1; 43 return -1;
44 } 44 }
@@ -53,46 +53,45 @@ void perf_session__set_id_hdr_size(struct perf_session *session)
53 machines__set_id_hdr_size(&session->machines, id_hdr_size); 53 machines__set_id_hdr_size(&session->machines, id_hdr_size);
54} 54}
55 55
56int perf_session__create_kernel_maps(struct perf_session *self) 56int perf_session__create_kernel_maps(struct perf_session *session)
57{ 57{
58 int ret = machine__create_kernel_maps(&self->machines.host); 58 int ret = machine__create_kernel_maps(&session->machines.host);
59 59
60 if (ret >= 0) 60 if (ret >= 0)
61 ret = machines__create_guest_kernel_maps(&self->machines); 61 ret = machines__create_guest_kernel_maps(&session->machines);
62 return ret; 62 return ret;
63} 63}
64 64
65static void perf_session__destroy_kernel_maps(struct perf_session *self) 65static void perf_session__destroy_kernel_maps(struct perf_session *session)
66{ 66{
67 machines__destroy_kernel_maps(&self->machines); 67 machines__destroy_kernel_maps(&session->machines);
68} 68}
69 69
70struct perf_session *perf_session__new(struct perf_data_file *file, 70struct perf_session *perf_session__new(struct perf_data_file *file,
71 bool repipe, struct perf_tool *tool) 71 bool repipe, struct perf_tool *tool)
72{ 72{
73 struct perf_session *self; 73 struct perf_session *session = zalloc(sizeof(*session));
74 74
75 self = zalloc(sizeof(*self)); 75 if (!session)
76 if (!self)
77 goto out; 76 goto out;
78 77
79 self->repipe = repipe; 78 session->repipe = repipe;
80 INIT_LIST_HEAD(&self->ordered_samples.samples); 79 INIT_LIST_HEAD(&session->ordered_samples.samples);
81 INIT_LIST_HEAD(&self->ordered_samples.sample_cache); 80 INIT_LIST_HEAD(&session->ordered_samples.sample_cache);
82 INIT_LIST_HEAD(&self->ordered_samples.to_free); 81 INIT_LIST_HEAD(&session->ordered_samples.to_free);
83 machines__init(&self->machines); 82 machines__init(&session->machines);
84 83
85 if (file) { 84 if (file) {
86 if (perf_data_file__open(file)) 85 if (perf_data_file__open(file))
87 goto out_delete; 86 goto out_delete;
88 87
89 self->file = file; 88 session->file = file;
90 89
91 if (perf_data_file__is_read(file)) { 90 if (perf_data_file__is_read(file)) {
92 if (perf_session__open(self) < 0) 91 if (perf_session__open(session) < 0)
93 goto out_close; 92 goto out_close;
94 93
95 perf_session__set_id_hdr_size(self); 94 perf_session__set_id_hdr_size(session);
96 } 95 }
97 } 96 }
98 97
@@ -101,22 +100,22 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
101 * In O_RDONLY mode this will be performed when reading the 100 * In O_RDONLY mode this will be performed when reading the
102 * kernel MMAP event, in perf_event__process_mmap(). 101 * kernel MMAP event, in perf_event__process_mmap().
103 */ 102 */
104 if (perf_session__create_kernel_maps(self) < 0) 103 if (perf_session__create_kernel_maps(session) < 0)
105 goto out_delete; 104 goto out_delete;
106 } 105 }
107 106
108 if (tool && tool->ordering_requires_timestamps && 107 if (tool && tool->ordering_requires_timestamps &&
109 tool->ordered_samples && !perf_evlist__sample_id_all(self->evlist)) { 108 tool->ordered_samples && !perf_evlist__sample_id_all(session->evlist)) {
110 dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n"); 109 dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
111 tool->ordered_samples = false; 110 tool->ordered_samples = false;
112 } 111 }
113 112
114 return self; 113 return session;
115 114
116 out_close: 115 out_close:
117 perf_data_file__close(file); 116 perf_data_file__close(file);
118 out_delete: 117 out_delete:
119 perf_session__delete(self); 118 perf_session__delete(session);
120 out: 119 out:
121 return NULL; 120 return NULL;
122} 121}
@@ -147,16 +146,16 @@ static void perf_session_env__delete(struct perf_session_env *env)
147 free(env->pmu_mappings); 146 free(env->pmu_mappings);
148} 147}
149 148
150void perf_session__delete(struct perf_session *self) 149void perf_session__delete(struct perf_session *session)
151{ 150{
152 perf_session__destroy_kernel_maps(self); 151 perf_session__destroy_kernel_maps(session);
153 perf_session__delete_dead_threads(self); 152 perf_session__delete_dead_threads(session);
154 perf_session__delete_threads(self); 153 perf_session__delete_threads(session);
155 perf_session_env__delete(&self->header.env); 154 perf_session_env__delete(&session->header.env);
156 machines__exit(&self->machines); 155 machines__exit(&session->machines);
157 if (self->file) 156 if (session->file)
158 perf_data_file__close(self->file); 157 perf_data_file__close(session->file);
159 free(self); 158 free(session);
160 vdso__exit(); 159 vdso__exit();
161} 160}
162 161
@@ -1084,11 +1083,11 @@ static int perf_session__process_event(struct perf_session *session,
1084 file_offset); 1083 file_offset);
1085} 1084}
1086 1085
1087void perf_event_header__bswap(struct perf_event_header *self) 1086void perf_event_header__bswap(struct perf_event_header *hdr)
1088{ 1087{
1089 self->type = bswap_32(self->type); 1088 hdr->type = bswap_32(hdr->type);
1090 self->misc = bswap_16(self->misc); 1089 hdr->misc = bswap_16(hdr->misc);
1091 self->size = bswap_16(self->size); 1090 hdr->size = bswap_16(hdr->size);
1092} 1091}
1093 1092
1094struct thread *perf_session__findnew(struct perf_session *session, pid_t pid) 1093struct thread *perf_session__findnew(struct perf_session *session, pid_t pid)
@@ -1096,9 +1095,9 @@ struct thread *perf_session__findnew(struct perf_session *session, pid_t pid)
1096 return machine__findnew_thread(&session->machines.host, 0, pid); 1095 return machine__findnew_thread(&session->machines.host, 0, pid);
1097} 1096}
1098 1097
1099static struct thread *perf_session__register_idle_thread(struct perf_session *self) 1098static struct thread *perf_session__register_idle_thread(struct perf_session *session)
1100{ 1099{
1101 struct thread *thread = perf_session__findnew(self, 0); 1100 struct thread *thread = perf_session__findnew(session, 0);
1102 1101
1103 if (thread == NULL || thread__set_comm(thread, "swapper", 0)) { 1102 if (thread == NULL || thread__set_comm(thread, "swapper", 0)) {
1104 pr_err("problem inserting idle task.\n"); 1103 pr_err("problem inserting idle task.\n");
@@ -1150,10 +1149,10 @@ static void perf_session__warn_about_errors(const struct perf_session *session,
1150 1149
1151volatile int session_done; 1150volatile int session_done;
1152 1151
1153static int __perf_session__process_pipe_events(struct perf_session *self, 1152static int __perf_session__process_pipe_events(struct perf_session *session,
1154 struct perf_tool *tool) 1153 struct perf_tool *tool)
1155{ 1154{
1156 int fd = perf_data_file__fd(self->file); 1155 int fd = perf_data_file__fd(session->file);
1157 union perf_event *event; 1156 union perf_event *event;
1158 uint32_t size, cur_size = 0; 1157 uint32_t size, cur_size = 0;
1159 void *buf = NULL; 1158 void *buf = NULL;
@@ -1181,7 +1180,7 @@ more:
1181 goto out_err; 1180 goto out_err;
1182 } 1181 }
1183 1182
1184 if (self->header.needs_swap) 1183 if (session->header.needs_swap)
1185 perf_event_header__bswap(&event->header); 1184 perf_event_header__bswap(&event->header);
1186 1185
1187 size = event->header.size; 1186 size = event->header.size;
@@ -1216,7 +1215,7 @@ more:
1216 } 1215 }
1217 } 1216 }
1218 1217
1219 if ((skip = perf_session__process_event(self, event, tool, head)) < 0) { 1218 if ((skip = perf_session__process_event(session, event, tool, head)) < 0) {
1220 pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", 1219 pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
1221 head, event->header.size, event->header.type); 1220 head, event->header.size, event->header.type);
1222 err = -EINVAL; 1221 err = -EINVAL;
@@ -1232,12 +1231,12 @@ more:
1232 goto more; 1231 goto more;
1233done: 1232done:
1234 /* do the final flush for ordered samples */ 1233 /* do the final flush for ordered samples */
1235 self->ordered_samples.next_flush = ULLONG_MAX; 1234 session->ordered_samples.next_flush = ULLONG_MAX;
1236 err = flush_sample_queue(self, tool); 1235 err = flush_sample_queue(session, tool);
1237out_err: 1236out_err:
1238 free(buf); 1237 free(buf);
1239 perf_session__warn_about_errors(self, tool); 1238 perf_session__warn_about_errors(session, tool);
1240 perf_session_free_sample_buffers(self); 1239 perf_session_free_sample_buffers(session);
1241 return err; 1240 return err;
1242} 1241}
1243 1242
@@ -1377,22 +1376,22 @@ out_err:
1377 return err; 1376 return err;
1378} 1377}
1379 1378
1380int perf_session__process_events(struct perf_session *self, 1379int perf_session__process_events(struct perf_session *session,
1381 struct perf_tool *tool) 1380 struct perf_tool *tool)
1382{ 1381{
1383 u64 size = perf_data_file__size(self->file); 1382 u64 size = perf_data_file__size(session->file);
1384 int err; 1383 int err;
1385 1384
1386 if (perf_session__register_idle_thread(self) == NULL) 1385 if (perf_session__register_idle_thread(session) == NULL)
1387 return -ENOMEM; 1386 return -ENOMEM;
1388 1387
1389 if (!perf_data_file__is_pipe(self->file)) 1388 if (!perf_data_file__is_pipe(session->file))
1390 err = __perf_session__process_events(self, 1389 err = __perf_session__process_events(session,
1391 self->header.data_offset, 1390 session->header.data_offset,
1392 self->header.data_size, 1391 session->header.data_size,
1393 size, tool); 1392 size, tool);
1394 else 1393 else
1395 err = __perf_session__process_pipe_events(self, tool); 1394 err = __perf_session__process_pipe_events(session, tool);
1396 1395
1397 return err; 1396 return err;
1398} 1397}
@@ -1441,15 +1440,15 @@ int maps__set_kallsyms_ref_reloc_sym(struct map **maps,
1441 return 0; 1440 return 0;
1442} 1441}
1443 1442
1444size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp) 1443size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp)
1445{ 1444{
1446 return machines__fprintf_dsos(&self->machines, fp); 1445 return machines__fprintf_dsos(&session->machines, fp);
1447} 1446}
1448 1447
1449size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, FILE *fp, 1448size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp,
1450 bool (skip)(struct dso *dso, int parm), int parm) 1449 bool (skip)(struct dso *dso, int parm), int parm)
1451{ 1450{
1452 return machines__fprintf_dsos_buildid(&self->machines, fp, skip, parm); 1451 return machines__fprintf_dsos_buildid(&session->machines, fp, skip, parm);
1453} 1452}
1454 1453
1455size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp) 1454size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 27c74d38b868..50f640958f0f 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -51,12 +51,12 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
51 bool repipe, struct perf_tool *tool); 51 bool repipe, struct perf_tool *tool);
52void perf_session__delete(struct perf_session *session); 52void perf_session__delete(struct perf_session *session);
53 53
54void perf_event_header__bswap(struct perf_event_header *self); 54void perf_event_header__bswap(struct perf_event_header *hdr);
55 55
56int __perf_session__process_events(struct perf_session *self, 56int __perf_session__process_events(struct perf_session *session,
57 u64 data_offset, u64 data_size, u64 size, 57 u64 data_offset, u64 data_size, u64 size,
58 struct perf_tool *tool); 58 struct perf_tool *tool);
59int perf_session__process_events(struct perf_session *self, 59int perf_session__process_events(struct perf_session *session,
60 struct perf_tool *tool); 60 struct perf_tool *tool);
61 61
62int perf_session_queue_event(struct perf_session *s, union perf_event *event, 62int perf_session_queue_event(struct perf_session *s, union perf_event *event,
@@ -64,37 +64,38 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event,
64 64
65void perf_tool__fill_defaults(struct perf_tool *tool); 65void perf_tool__fill_defaults(struct perf_tool *tool);
66 66
67int perf_session__resolve_callchain(struct perf_session *self, struct perf_evsel *evsel, 67int perf_session__resolve_callchain(struct perf_session *session,
68 struct perf_evsel *evsel,
68 struct thread *thread, 69 struct thread *thread,
69 struct ip_callchain *chain, 70 struct ip_callchain *chain,
70 struct symbol **parent); 71 struct symbol **parent);
71 72
72bool perf_session__has_traces(struct perf_session *self, const char *msg); 73bool perf_session__has_traces(struct perf_session *session, const char *msg);
73 74
74void mem_bswap_64(void *src, int byte_size); 75void mem_bswap_64(void *src, int byte_size);
75void mem_bswap_32(void *src, int byte_size); 76void mem_bswap_32(void *src, int byte_size);
76void perf_event__attr_swap(struct perf_event_attr *attr); 77void perf_event__attr_swap(struct perf_event_attr *attr);
77 78
78int perf_session__create_kernel_maps(struct perf_session *self); 79int perf_session__create_kernel_maps(struct perf_session *session);
79 80
80void perf_session__set_id_hdr_size(struct perf_session *session); 81void perf_session__set_id_hdr_size(struct perf_session *session);
81 82
82static inline 83static inline
83struct machine *perf_session__find_machine(struct perf_session *self, pid_t pid) 84struct machine *perf_session__find_machine(struct perf_session *session, pid_t pid)
84{ 85{
85 return machines__find(&self->machines, pid); 86 return machines__find(&session->machines, pid);
86} 87}
87 88
88static inline 89static inline
89struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t pid) 90struct machine *perf_session__findnew_machine(struct perf_session *session, pid_t pid)
90{ 91{
91 return machines__findnew(&self->machines, pid); 92 return machines__findnew(&session->machines, pid);
92} 93}
93 94
94struct thread *perf_session__findnew(struct perf_session *self, pid_t pid); 95struct thread *perf_session__findnew(struct perf_session *session, pid_t pid);
95size_t perf_session__fprintf(struct perf_session *self, FILE *fp); 96size_t perf_session__fprintf(struct perf_session *session, FILE *fp);
96 97
97size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp); 98size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp);
98 99
99size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp, 100size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp,
100 bool (fn)(struct dso *dso, int parm), int parm); 101 bool (fn)(struct dso *dso, int parm), int parm);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index f4e16f359d64..f4cc147e0220 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -180,7 +180,7 @@ struct sort_entry {
180 180
181 int64_t (*se_cmp)(struct hist_entry *, struct hist_entry *); 181 int64_t (*se_cmp)(struct hist_entry *, struct hist_entry *);
182 int64_t (*se_collapse)(struct hist_entry *, struct hist_entry *); 182 int64_t (*se_collapse)(struct hist_entry *, struct hist_entry *);
183 int (*se_snprintf)(struct hist_entry *self, char *bf, size_t size, 183 int (*se_snprintf)(struct hist_entry *he, char *bf, size_t size,
184 unsigned int width); 184 unsigned int width);
185 u8 se_width_idx; 185 u8 se_width_idx;
186 bool elide; 186 bool elide;
diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c
index 67e4a0082822..3edd0538161f 100644
--- a/tools/perf/util/strfilter.c
+++ b/tools/perf/util/strfilter.c
@@ -62,15 +62,15 @@ static struct strfilter_node *strfilter_node__alloc(const char *op,
62 struct strfilter_node *l, 62 struct strfilter_node *l,
63 struct strfilter_node *r) 63 struct strfilter_node *r)
64{ 64{
65 struct strfilter_node *ret = zalloc(sizeof(struct strfilter_node)); 65 struct strfilter_node *node = zalloc(sizeof(*node));
66 66
67 if (ret) { 67 if (node) {
68 ret->p = op; 68 node->p = op;
69 ret->l = l; 69 node->l = l;
70 ret->r = r; 70 node->r = r;
71 } 71 }
72 72
73 return ret; 73 return node;
74} 74}
75 75
76static struct strfilter_node *strfilter_node__new(const char *s, 76static struct strfilter_node *strfilter_node__new(const char *s,
@@ -154,20 +154,20 @@ error:
154 */ 154 */
155struct strfilter *strfilter__new(const char *rules, const char **err) 155struct strfilter *strfilter__new(const char *rules, const char **err)
156{ 156{
157 struct strfilter *ret = zalloc(sizeof(struct strfilter)); 157 struct strfilter *filter = zalloc(sizeof(*filter));
158 const char *ep = NULL; 158 const char *ep = NULL;
159 159
160 if (ret) 160 if (filter)
161 ret->root = strfilter_node__new(rules, &ep); 161 filter->root = strfilter_node__new(rules, &ep);
162 162
163 if (!ret || !ret->root || *ep != '\0') { 163 if (!filter || !filter->root || *ep != '\0') {
164 if (err) 164 if (err)
165 *err = ep; 165 *err = ep;
166 strfilter__delete(ret); 166 strfilter__delete(filter);
167 ret = NULL; 167 filter = NULL;
168 } 168 }
169 169
170 return ret; 170 return filter;
171} 171}
172 172
173static bool strfilter_node__compare(struct strfilter_node *node, 173static bool strfilter_node__compare(struct strfilter_node *node,
@@ -191,9 +191,9 @@ static bool strfilter_node__compare(struct strfilter_node *node,
191} 191}
192 192
193/* Return true if STR matches the filter rules */ 193/* Return true if STR matches the filter rules */
194bool strfilter__compare(struct strfilter *node, const char *str) 194bool strfilter__compare(struct strfilter *filter, const char *str)
195{ 195{
196 if (!node) 196 if (!filter)
197 return false; 197 return false;
198 return strfilter_node__compare(node->root, str); 198 return strfilter_node__compare(filter->root, str);
199} 199}
diff --git a/tools/perf/util/strfilter.h b/tools/perf/util/strfilter.h
index 00f58a7506de..fe611f3c9e39 100644
--- a/tools/perf/util/strfilter.h
+++ b/tools/perf/util/strfilter.h
@@ -30,19 +30,19 @@ struct strfilter *strfilter__new(const char *rules, const char **err);
30 30
31/** 31/**
32 * strfilter__compare - compare given string and a string filter 32 * strfilter__compare - compare given string and a string filter
33 * @self: String filter 33 * @filter: String filter
34 * @str: target string 34 * @str: target string
35 * 35 *
36 * Compare @str and @self. Return true if the str match the rule 36 * Compare @str and @filter. Return true if the str match the rule
37 */ 37 */
38bool strfilter__compare(struct strfilter *self, const char *str); 38bool strfilter__compare(struct strfilter *filter, const char *str);
39 39
40/** 40/**
41 * strfilter__delete - delete a string filter 41 * strfilter__delete - delete a string filter
42 * @self: String filter to delete 42 * @filter: String filter to delete
43 * 43 *
44 * Delete @self. 44 * Delete @filter.
45 */ 45 */
46void strfilter__delete(struct strfilter *self); 46void strfilter__delete(struct strfilter *filter);
47 47
48#endif 48#endif
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 373c055989ed..897c1b2a750a 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -29,24 +29,24 @@ struct machine;
29struct comm; 29struct comm;
30 30
31struct thread *thread__new(pid_t pid, pid_t tid); 31struct thread *thread__new(pid_t pid, pid_t tid);
32void thread__delete(struct thread *self); 32void thread__delete(struct thread *thread);
33static inline void thread__exited(struct thread *thread) 33static inline void thread__exited(struct thread *thread)
34{ 34{
35 thread->dead = true; 35 thread->dead = true;
36} 36}
37 37
38int thread__set_comm(struct thread *thread, const char *comm, u64 timestamp); 38int thread__set_comm(struct thread *thread, const char *comm, u64 timestamp);
39int thread__comm_len(struct thread *self); 39int thread__comm_len(struct thread *thread);
40struct comm *thread__comm(const struct thread *thread); 40struct comm *thread__comm(const struct thread *thread);
41const char *thread__comm_str(const struct thread *thread); 41const char *thread__comm_str(const struct thread *thread);
42void thread__insert_map(struct thread *self, struct map *map); 42void thread__insert_map(struct thread *thread, struct map *map);
43int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp); 43int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp);
44size_t thread__fprintf(struct thread *thread, FILE *fp); 44size_t thread__fprintf(struct thread *thread, FILE *fp);
45 45
46static inline struct map *thread__find_map(struct thread *self, 46static inline struct map *thread__find_map(struct thread *thread,
47 enum map_type type, u64 addr) 47 enum map_type type, u64 addr)
48{ 48{
49 return self ? map_groups__find(&self->mg, type, addr) : NULL; 49 return thread ? map_groups__find(&thread->mg, type, addr) : NULL;
50} 50}
51 51
52void thread__find_addr_map(struct thread *thread, struct machine *machine, 52void thread__find_addr_map(struct thread *thread, struct machine *machine,