diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-05 13:32:36 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-05 13:32:36 -0500 |
commit | 316c7136f8bad924609163b9b115f68d59a68c82 (patch) | |
tree | ba664f98d92563544aa63dfb63ae4b49c27929c6 /tools/perf/ui | |
parent | 714647bdc516330e4405b39677d7f763e016c685 (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/perf/ui')
-rw-r--r-- | tools/perf/ui/browser.h | 32 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/browsers/map.c | 40 | ||||
-rw-r--r-- | tools/perf/ui/browsers/map.h | 2 | ||||
-rw-r--r-- | tools/perf/ui/browsers/scripts.c | 8 | ||||
-rw-r--r-- | tools/perf/ui/stdio/hist.c | 14 |
6 files changed, 48 insertions, 50 deletions
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 | ||
33 | int ui_browser__set_color(struct ui_browser *browser, int color); | 33 | int ui_browser__set_color(struct ui_browser *browser, int color); |
34 | void ui_browser__set_percent_color(struct ui_browser *self, | 34 | void ui_browser__set_percent_color(struct ui_browser *browser, |
35 | double percent, bool current); | 35 | double percent, bool current); |
36 | bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row); | 36 | bool ui_browser__is_current_entry(struct ui_browser *browser, unsigned row); |
37 | void ui_browser__refresh_dimensions(struct ui_browser *self); | 37 | void ui_browser__refresh_dimensions(struct ui_browser *browser); |
38 | void ui_browser__reset_index(struct ui_browser *self); | 38 | void ui_browser__reset_index(struct ui_browser *browser); |
39 | 39 | ||
40 | void ui_browser__gotorc(struct ui_browser *self, int y, int x); | 40 | void ui_browser__gotorc(struct ui_browser *browser, int y, int x); |
41 | void ui_browser__write_graph(struct ui_browser *browser, int graph); | 41 | void ui_browser__write_graph(struct ui_browser *browser, int graph); |
42 | void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, | 42 | void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, |
43 | u64 start, u64 end); | 43 | u64 start, u64 end); |
44 | void __ui_browser__show_title(struct ui_browser *browser, const char *title); | 44 | void __ui_browser__show_title(struct ui_browser *browser, const char *title); |
45 | void ui_browser__show_title(struct ui_browser *browser, const char *title); | 45 | void ui_browser__show_title(struct ui_browser *browser, const char *title); |
46 | int ui_browser__show(struct ui_browser *self, const char *title, | 46 | int ui_browser__show(struct ui_browser *browser, const char *title, |
47 | const char *helpline, ...); | 47 | const char *helpline, ...); |
48 | void ui_browser__hide(struct ui_browser *self); | 48 | void ui_browser__hide(struct ui_browser *browser); |
49 | int ui_browser__refresh(struct ui_browser *self); | 49 | int ui_browser__refresh(struct ui_browser *browser); |
50 | int ui_browser__run(struct ui_browser *browser, int delay_secs); | 50 | int ui_browser__run(struct ui_browser *browser, int delay_secs); |
51 | void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries); | 51 | void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries); |
52 | void ui_browser__handle_resize(struct ui_browser *browser); | 52 | void 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, | |||
63 | void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence); | 63 | void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence); |
64 | unsigned int ui_browser__argv_refresh(struct ui_browser *browser); | 64 | unsigned int ui_browser__argv_refresh(struct ui_browser *browser); |
65 | 65 | ||
66 | void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence); | 66 | void ui_browser__rb_tree_seek(struct ui_browser *browser, off_t offset, int whence); |
67 | unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self); | 67 | unsigned int ui_browser__rb_tree_refresh(struct ui_browser *browser); |
68 | 68 | ||
69 | void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence); | 69 | void ui_browser__list_head_seek(struct ui_browser *browser, off_t offset, int whence); |
70 | unsigned int ui_browser__list_head_refresh(struct ui_browser *self); | 70 | unsigned int ui_browser__list_head_refresh(struct ui_browser *browser); |
71 | 71 | ||
72 | void ui_browser__init(void); | 72 | void ui_browser__init(void); |
73 | void annotate_browser__init(void); | 73 | void 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 | ||
1892 | static bool filter_group_entries(struct ui_browser *self __maybe_unused, | 1892 | static 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 | ||
21 | static void map_browser__write(struct ui_browser *self, void *nd, int row) | 21 | static 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... */ |
39 | static u32 *symbol__browser_index(struct symbol *self) | 39 | static 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 | ||
44 | static int map_browser__search(struct map_browser *self) | 44 | static 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 | ||
71 | static int map_browser__run(struct map_browser *self) | 71 | static 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 | } |
96 | out: | 96 | out: |
97 | ui_browser__hide(&self->b); | 97 | ui_browser__hide(&browser->b); |
98 | return key; | 98 | return key; |
99 | } | 99 | } |
100 | 100 | ||
101 | int map__browse(struct map *self) | 101 | int 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 |
3 | struct map; | 3 | struct map; |
4 | 4 | ||
5 | int map__browse(struct map *self); | 5 | int 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 | ||
87 | static int script_browser__run(struct perf_script_browser *self) | 87 | static 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 | ||
216 | static size_t __callchain__fprintf_flat(FILE *fp, | 216 | static 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 | ||
242 | static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *self, | 241 | static 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 | ||