aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-15 17:04:40 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-16 02:53:49 -0500
commit655000e7c75a559681ee7f15f6fa870c80ae3194 (patch)
tree69a56e19c818b0929dbea8d119fa133853c5ee80 /tools/perf/util
parent75be6cf48738aec68aac49b428423569492cfba3 (diff)
perf symbols: Adopt the strlists for dso, comm
Will be used in perf diff too. 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: <1260914682-29652-2-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/symbol.c33
-rw-r--r--tools/perf/util/symbol.h9
2 files changed, 42 insertions, 0 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 17ce01269a91..164286ace7df 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1,6 +1,7 @@
1#include "util.h" 1#include "util.h"
2#include "../perf.h" 2#include "../perf.h"
3#include "session.h" 3#include "session.h"
4#include "sort.h"
4#include "string.h" 5#include "string.h"
5#include "symbol.h" 6#include "symbol.h"
6#include "thread.h" 7#include "thread.h"
@@ -1739,6 +1740,20 @@ out_fail:
1739 return -1; 1740 return -1;
1740} 1741}
1741 1742
1743static int setup_list(struct strlist **list, const char *list_str,
1744 const char *list_name)
1745{
1746 if (list_str == NULL)
1747 return 0;
1748
1749 *list = strlist__new(true, list_str);
1750 if (!*list) {
1751 pr_err("problems parsing %s list\n", list_name);
1752 return -1;
1753 }
1754 return 0;
1755}
1756
1742int symbol__init(void) 1757int symbol__init(void)
1743{ 1758{
1744 elf_version(EV_CURRENT); 1759 elf_version(EV_CURRENT);
@@ -1749,7 +1764,25 @@ int symbol__init(void)
1749 if (symbol_conf.try_vmlinux_path && vmlinux_path__init() < 0) 1764 if (symbol_conf.try_vmlinux_path && vmlinux_path__init() < 0)
1750 return -1; 1765 return -1;
1751 1766
1767 if (setup_list(&symbol_conf.dso_list,
1768 symbol_conf.dso_list_str, "dso") < 0)
1769 return -1;
1770
1771 if (setup_list(&symbol_conf.comm_list,
1772 symbol_conf.comm_list_str, "comm") < 0)
1773 goto out_free_dso_list;
1774
1775 if (setup_list(&symbol_conf.sym_list,
1776 symbol_conf.sym_list_str, "symbol") < 0)
1777 goto out_free_comm_list;
1778
1752 return 0; 1779 return 0;
1780
1781out_free_dso_list:
1782 strlist__delete(symbol_conf.dso_list);
1783out_free_comm_list:
1784 strlist__delete(symbol_conf.comm_list);
1785 return -1;
1753} 1786}
1754 1787
1755int perf_session__create_kernel_maps(struct perf_session *self) 1788int perf_session__create_kernel_maps(struct perf_session *self)
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 766294735f93..d61f35074997 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -49,12 +49,21 @@ struct symbol {
49 char name[0]; 49 char name[0];
50}; 50};
51 51
52struct strlist;
53
52struct symbol_conf { 54struct symbol_conf {
53 unsigned short priv_size; 55 unsigned short priv_size;
54 bool try_vmlinux_path, 56 bool try_vmlinux_path,
55 use_modules, 57 use_modules,
56 sort_by_name; 58 sort_by_name;
57 const char *vmlinux_name; 59 const char *vmlinux_name;
60 char *dso_list_str,
61 *comm_list_str,
62 *sym_list_str,
63 *col_width_list_str;
64 struct strlist *dso_list,
65 *comm_list,
66 *sym_list;
58}; 67};
59 68
60extern struct symbol_conf symbol_conf; 69extern struct symbol_conf symbol_conf;