summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-03-24 16:40:17 -0300
committerIngo Molnar <mingo@elte.hu>2010-03-26 08:52:57 +0100
commit59fd53062f71011a68d03f4cd0ba93d822ac3249 (patch)
treed707ca954b8e1fb9c0808b23d83951f357ac8a0d /tools/perf/util
parentac73c5a9c1767b2771e6d2b5accafdef89db04c2 (diff)
downloadtalos-op-linux-59fd53062f71011a68d03f4cd0ba93d822ac3249.tar.gz
talos-op-linux-59fd53062f71011a68d03f4cd0ba93d822ac3249.zip
perf tools: Introduce struct map_symbol
That will be in both struct hist_entry and struct callchain_list, so that the TUI can store a pointer to the pair (map, symbol) in the trees where hist_entries and callchain_lists are present, to allow precise annotation instead of looking for the first symbol with the selected name. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1269459619-982-4-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/hist.c8
-rw-r--r--tools/perf/util/newt.c4
-rw-r--r--tools/perf/util/sort.c22
-rw-r--r--tools/perf/util/sort.h3
-rw-r--r--tools/perf/util/symbol.h5
5 files changed, 24 insertions, 18 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 5843a9c572ad..4eefb52a8661 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -22,8 +22,10 @@ struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
struct hist_entry *he;
struct hist_entry entry = {
.thread = al->thread,
- .map = al->map,
- .sym = al->sym,
+ .ms = {
+ .map = al->map,
+ .sym = al->sym,
+ },
.ip = al->addr,
.level = al->level,
.count = count,
@@ -654,7 +656,7 @@ print_entries:
if (symbol_conf.use_callchain)
ret += hist_entry__fprintf_callchain(h, fp, session_total);
- if (h->map == NULL && verbose > 1) {
+ if (h->ms.map == NULL && verbose > 1) {
__map_groups__fprintf_maps(&h->thread->mg,
MAP__FUNCTION, fp);
fprintf(fp, "%.10s end\n", graph_dotted_line);
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index a3465a0ad70d..25cd2e1f4251 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -287,9 +287,9 @@ static size_t hist_entry__append_browser(struct hist_entry *self,
indexes[0] = NEWT_ARG_APPEND;
indexes[1] = NEWT_ARG_LAST;
- newt_checkbox_tree__add(tree, s, self->sym, indexes);
+ newt_checkbox_tree__add(tree, s, self->ms.sym, indexes);
} else
- newtListboxAppendEntry(tree, s, self->sym);
+ newtListboxAppendEntry(tree, s, self->ms.sym);
return strlen(s);
}
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index cb0f327de9e8..9b80c13cae46 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -131,8 +131,8 @@ sort__comm_print(FILE *fp, struct hist_entry *self, unsigned int width)
int64_t
sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
{
- struct dso *dso_l = left->map ? left->map->dso : NULL;
- struct dso *dso_r = right->map ? right->map->dso : NULL;
+ struct dso *dso_l = left->ms.map ? left->ms.map->dso : NULL;
+ struct dso *dso_r = right->ms.map ? right->ms.map->dso : NULL;
const char *dso_name_l, *dso_name_r;
if (!dso_l || !dso_r)
@@ -152,9 +152,9 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
size_t
sort__dso_print(FILE *fp, struct hist_entry *self, unsigned int width)
{
- if (self->map && self->map->dso) {
- const char *dso_name = !verbose ? self->map->dso->short_name :
- self->map->dso->long_name;
+ if (self->ms.map && self->ms.map->dso) {
+ const char *dso_name = !verbose ? self->ms.map->dso->short_name :
+ self->ms.map->dso->long_name;
return repsep_fprintf(fp, "%-*s", width, dso_name);
}
@@ -168,11 +168,11 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
{
u64 ip_l, ip_r;
- if (left->sym == right->sym)
+ if (left->ms.sym == right->ms.sym)
return 0;
- ip_l = left->sym ? left->sym->start : left->ip;
- ip_r = right->sym ? right->sym->start : right->ip;
+ ip_l = left->ms.sym ? left->ms.sym->start : left->ip;
+ ip_r = right->ms.sym ? right->ms.sym->start : right->ip;
return (int64_t)(ip_r - ip_l);
}
@@ -184,13 +184,13 @@ sort__sym_print(FILE *fp, struct hist_entry *self, unsigned int width __used)
size_t ret = 0;
if (verbose) {
- char o = self->map ? dso__symtab_origin(self->map->dso) : '!';
+ char o = self->ms.map ? dso__symtab_origin(self->ms.map->dso) : '!';
ret += repsep_fprintf(fp, "%#018llx %c ", (u64)self->ip, o);
}
ret += repsep_fprintf(fp, "[%c] ", self->level);
- if (self->sym)
- ret += repsep_fprintf(fp, "%s", self->sym->name);
+ if (self->ms.sym)
+ ret += repsep_fprintf(fp, "%s", self->ms.sym->name);
else
ret += repsep_fprintf(fp, "%#016llx", (u64)self->ip);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 753f9ea99fb0..598568696f97 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -45,8 +45,7 @@ struct hist_entry {
struct rb_node rb_node;
u64 count;
struct thread *thread;
- struct map *map;
- struct symbol *sym;
+ struct map_symbol ms;
u64 ip;
char level;
struct symbol *parent;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0da2455d5b90..a4a894b8ea03 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -88,6 +88,11 @@ struct ref_reloc_sym {
u64 unrelocated_addr;
};
+struct map_symbol {
+ struct map *map;
+ struct symbol *sym;
+};
+
struct addr_location {
struct thread *thread;
struct map *map;
OpenPOWER on IntegriCloud