aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-17 15:38:00 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-19 00:03:38 -0500
commit51a472decb845e920137284a5cfef51fb7d61206 (patch)
tree73afe582cf006532f3c21cb3495e07c09b60c0e6 /tools/perf/builtin-top.c
parent1a105f743d9fa5f7b8eeeca0afb789951164a361 (diff)
perf top: Introduce helper function to access symbol from sym_entry
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: <1258490282-1821-1-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6db0e37ee33b..0d60c517c0ba 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -128,6 +128,11 @@ struct sym_entry {
128 * Source functions 128 * Source functions
129 */ 129 */
130 130
131static inline struct symbol *sym_entry__symbol(struct sym_entry *self)
132{
133 return (struct symbol *)(self + 1);
134}
135
131static void get_term_dimensions(struct winsize *ws) 136static void get_term_dimensions(struct winsize *ws)
132{ 137{
133 char *s = getenv("LINES"); 138 char *s = getenv("LINES");
@@ -181,7 +186,7 @@ static void parse_source(struct sym_entry *syme)
181 goto out_assign; 186 goto out_assign;
182 } 187 }
183 188
184 sym = (struct symbol *)(syme + 1); 189 sym = sym_entry__symbol(syme);
185 map = syme->map; 190 map = syme->map;
186 path = map->dso->long_name; 191 path = map->dso->long_name;
187 192
@@ -276,7 +281,7 @@ out_unlock:
276 281
277static void lookup_sym_source(struct sym_entry *syme) 282static void lookup_sym_source(struct sym_entry *syme)
278{ 283{
279 struct symbol *symbol = (struct symbol *)(syme + 1); 284 struct symbol *symbol = sym_entry__symbol(syme);
280 struct source_line *line; 285 struct source_line *line;
281 char pattern[PATH_MAX]; 286 char pattern[PATH_MAX];
282 287
@@ -325,7 +330,7 @@ static void show_details(struct sym_entry *syme)
325 if (!syme->source) 330 if (!syme->source)
326 return; 331 return;
327 332
328 symbol = (struct symbol *)(syme + 1); 333 symbol = sym_entry__symbol(syme);
329 printf("Showing %s for %s\n", event_name(sym_counter), symbol->name); 334 printf("Showing %s for %s\n", event_name(sym_counter), symbol->name);
330 printf(" Events Pcnt (>=%d%%)\n", sym_pcnt_filter); 335 printf(" Events Pcnt (>=%d%%)\n", sym_pcnt_filter);
331 336
@@ -573,7 +578,7 @@ static void print_sym_table(void)
573 double pcnt; 578 double pcnt;
574 579
575 syme = rb_entry(nd, struct sym_entry, rb_node); 580 syme = rb_entry(nd, struct sym_entry, rb_node);
576 sym = (struct symbol *)(syme + 1); 581 sym = sym_entry__symbol(syme);
577 582
578 if (++printed > print_entries || (int)syme->snap_count < count_filter) 583 if (++printed > print_entries || (int)syme->snap_count < count_filter)
579 continue; 584 continue;
@@ -661,7 +666,7 @@ static void prompt_symbol(struct sym_entry **target, const char *msg)
661 pthread_mutex_unlock(&active_symbols_lock); 666 pthread_mutex_unlock(&active_symbols_lock);
662 667
663 list_for_each_entry_safe_from(syme, n, &active_symbols, node) { 668 list_for_each_entry_safe_from(syme, n, &active_symbols, node) {
664 struct symbol *sym = (struct symbol *)(syme + 1); 669 struct symbol *sym = sym_entry__symbol(syme);
665 670
666 if (!strcmp(buf, sym->name)) { 671 if (!strcmp(buf, sym->name)) {
667 found = syme; 672 found = syme;
@@ -685,7 +690,7 @@ static void print_mapped_keys(void)
685 char *name = NULL; 690 char *name = NULL;
686 691
687 if (sym_filter_entry) { 692 if (sym_filter_entry) {
688 struct symbol *sym = (struct symbol *)(sym_filter_entry+1); 693 struct symbol *sym = sym_entry__symbol(sym_filter_entry);
689 name = sym->name; 694 name = sym->name;
690 } 695 }
691 696