diff options
Diffstat (limited to 'tools/perf/ui/browsers')
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 24 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 23 | ||||
-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 |
5 files changed, 48 insertions, 49 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index f0697a3..08545ae 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -442,37 +442,35 @@ static bool annotate_browser__callq(struct annotate_browser *browser, { struct map_symbol *ms = browser->b.priv; struct disasm_line *dl = browser->selection; + struct symbol *sym = ms->sym; struct annotation *notes; - struct addr_map_symbol target = { - .map = ms->map, - .addr = map__objdump_2mem(ms->map, dl->ops.target.addr), - }; + struct symbol *target; + u64 ip; char title[SYM_TITLE_MAX_SIZE]; if (!ins__is_call(dl->ins)) return false; - if (map_groups__find_ams(&target, NULL) || - map__rip_2objdump(target.map, target.map->map_ip(target.map, - target.addr)) != - dl->ops.target.addr) { + ip = ms->map->map_ip(ms->map, dl->ops.target.addr); + target = map__find_symbol(ms->map, ip, NULL); + if (target == NULL) { ui_helpline__puts("The called function was not found."); return true; } - notes = symbol__annotation(target.sym); + notes = symbol__annotation(target); pthread_mutex_lock(¬es->lock); - if (notes->src == NULL && symbol__alloc_hist(target.sym) < 0) { + if (notes->src == NULL && symbol__alloc_hist(target) < 0) { pthread_mutex_unlock(¬es->lock); ui__warning("Not enough memory for annotating '%s' symbol!\n", - target.sym->name); + target->name); return true; } pthread_mutex_unlock(¬es->lock); - symbol__tui_annotate(target.sym, target.map, evsel, hbt); - sym_title(ms->sym, ms->map, title, sizeof(title)); + symbol__tui_annotate(target, ms->map, evsel, hbt); + sym_title(sym, ms->map, title, sizeof(title)); ui_browser__show_title(&browser->b, title); return true; } diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index a440e03..7ef36c3 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -1255,7 +1255,7 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size, if (thread) printed += scnprintf(bf + printed, size - printed, ", Thread: %s(%d)", - (thread->comm_set ? thread__comm_str(thread) : ""), + (thread->comm_set ? thread->comm : ""), thread->tid); if (dso) printed += scnprintf(bf + printed, size - printed, @@ -1578,7 +1578,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, if (thread != NULL && asprintf(&options[nr_options], "Zoom %s %s(%d) thread", (browser->hists->thread_filter ? "out of" : "into"), - (thread->comm_set ? thread__comm_str(thread) : ""), + (thread->comm_set ? thread->comm : ""), thread->tid) > 0) zoom_thread = nr_options++; @@ -1598,7 +1598,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, struct symbol *sym; if (asprintf(&options[nr_options], "Run scripts for samples of thread [%s]", - thread__comm_str(browser->he_selection->thread)) > 0) + browser->he_selection->thread->comm) > 0) scripts_comm = nr_options++; sym = browser->he_selection->ms.sym; @@ -1701,7 +1701,7 @@ zoom_out_thread: sort_thread.elide = false; } else { ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"", - thread->comm_set ? thread__comm_str(thread) : "", + thread->comm_set ? thread->comm : "", thread->tid); browser->hists->thread_filter = thread; sort_thread.elide = true; @@ -1717,7 +1717,7 @@ do_scripts: memset(script_opt, 0, 64); if (choice == scripts_comm) - sprintf(script_opt, " -c %s ", thread__comm_str(browser->he_selection->thread)); + sprintf(script_opt, " -c %s ", browser->he_selection->thread->comm); if (choice == scripts_symbol) sprintf(script_opt, " -S %s ", browser->he_selection->ms.sym->name); @@ -1847,15 +1847,15 @@ browse_hists: switch (key) { case K_TAB: if (pos->node.next == &evlist->entries) - pos = perf_evlist__first(evlist); + pos = list_entry(evlist->entries.next, struct perf_evsel, node); else - pos = perf_evsel__next(pos); + pos = list_entry(pos->node.next, struct perf_evsel, node); goto browse_hists; case K_UNTAB: if (pos->node.prev == &evlist->entries) - pos = perf_evlist__last(evlist); + pos = list_entry(evlist->entries.prev, struct perf_evsel, node); else - pos = perf_evsel__prev(pos); + pos = list_entry(pos->node.prev, struct perf_evsel, node); goto browse_hists; case K_ESC: if (!ui_browser__dialog_yesno(&menu->b, @@ -1889,7 +1889,7 @@ out: return key; } -static bool filter_group_entries(struct ui_browser *browser __maybe_unused, +static bool filter_group_entries(struct ui_browser *self __maybe_unused, void *entry) { struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); @@ -1943,7 +1943,8 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, single_entry: if (nr_entries == 1) { - struct perf_evsel *first = perf_evlist__first(evlist); + struct perf_evsel *first = list_entry(evlist->entries.next, + struct perf_evsel, node); const char *ev_name = perf_evsel__name(first); return perf_evsel__hists_browse(first, nr_entries, help, diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index b11639f..95c7cfb 100644 --- a/tools/perf/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c @@ -18,30 +18,30 @@ struct map_browser { u8 addrlen; }; -static void map_browser__write(struct ui_browser *browser, void *nd, int row) +static void map_browser__write(struct ui_browser *self, void *nd, int row) { struct symbol *sym = rb_entry(nd, struct symbol, rb_node); - struct map_browser *mb = container_of(browser, struct map_browser, b); - bool current_entry = ui_browser__is_current_entry(browser, row); + struct map_browser *mb = container_of(self, struct map_browser, b); + bool current_entry = ui_browser__is_current_entry(self, row); int width; - ui_browser__set_percent_color(browser, 0, current_entry); + ui_browser__set_percent_color(self, 0, current_entry); slsmg_printf("%*" PRIx64 " %*" PRIx64 " %c ", mb->addrlen, sym->start, mb->addrlen, sym->end, sym->binding == STB_GLOBAL ? 'g' : sym->binding == STB_LOCAL ? 'l' : 'w'); - width = browser->width - ((mb->addrlen * 2) + 4); + width = self->width - ((mb->addrlen * 2) + 4); if (width > 0) slsmg_write_nstring(sym->name, width); } /* FIXME uber-kludgy, see comment on cmd_report... */ -static u32 *symbol__browser_index(struct symbol *browser) +static u32 *symbol__browser_index(struct symbol *self) { - return ((void *)browser) - sizeof(struct rb_node) - sizeof(u32); + return ((void *)self) - sizeof(struct rb_node) - sizeof(u32); } -static int map_browser__search(struct map_browser *browser) +static int map_browser__search(struct map_browser *self) { char target[512]; struct symbol *sym; @@ -53,37 +53,37 @@ static int map_browser__search(struct map_browser *browser) if (target[0] == '0' && tolower(target[1]) == 'x') { u64 addr = strtoull(target, NULL, 16); - sym = map__find_symbol(browser->map, addr, NULL); + sym = map__find_symbol(self->map, addr, NULL); } else - sym = map__find_symbol_by_name(browser->map, target, NULL); + sym = map__find_symbol_by_name(self->map, target, NULL); if (sym != NULL) { u32 *idx = symbol__browser_index(sym); - browser->b.top = &sym->rb_node; - browser->b.index = browser->b.top_idx = *idx; + self->b.top = &sym->rb_node; + self->b.index = self->b.top_idx = *idx; } else ui_helpline__fpush("%s not found!", target); return 0; } -static int map_browser__run(struct map_browser *browser) +static int map_browser__run(struct map_browser *self) { int key; - if (ui_browser__show(&browser->b, browser->map->dso->long_name, + if (ui_browser__show(&self->b, self->map->dso->long_name, "Press <- or ESC to exit, %s / to search", verbose ? "" : "restart with -v to use") < 0) return -1; while (1) { - key = ui_browser__run(&browser->b, 0); + key = ui_browser__run(&self->b, 0); switch (key) { case '/': if (verbose) - map_browser__search(browser); + map_browser__search(self); default: break; case K_LEFT: @@ -94,20 +94,20 @@ static int map_browser__run(struct map_browser *browser) } } out: - ui_browser__hide(&browser->b); + ui_browser__hide(&self->b); return key; } -int map__browse(struct map *map) +int map__browse(struct map *self) { struct map_browser mb = { .b = { - .entries = &map->dso->symbols[map->type], + .entries = &self->dso->symbols[self->type], .refresh = ui_browser__rb_tree_refresh, .seek = ui_browser__rb_tree_seek, .write = map_browser__write, }, - .map = map, + .map = self, }; struct rb_node *nd; char tmp[BITS_PER_LONG / 4]; diff --git a/tools/perf/ui/browsers/map.h b/tools/perf/ui/browsers/map.h index 2d58e4b..df8581a 100644 --- a/tools/perf/ui/browsers/map.h +++ b/tools/perf/ui/browsers/map.h @@ -2,5 +2,5 @@ #define _PERF_UI_MAP_BROWSER_H_ 1 struct map; -int map__browse(struct map *map); +int map__browse(struct map *self); #endif /* _PERF_UI_MAP_BROWSER_H_ */ diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c index d63c68e..12f009e 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, slsmg_write_nstring(sline->line, browser->width); } -static int script_browser__run(struct perf_script_browser *browser) +static int script_browser__run(struct perf_script_browser *self) { int key; - if (ui_browser__show(&browser->b, browser->script_name, + if (ui_browser__show(&self->b, self->script_name, "Press <- or ESC to exit") < 0) return -1; while (1) { - key = ui_browser__run(&browser->b, 0); + key = ui_browser__run(&self->b, 0); /* We can add some special key handling here if needed */ break; } - ui_browser__hide(&browser->b); + ui_browser__hide(&self->b); return key; } |