aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-24 09:05:15 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-24 10:37:02 -0500
commitb32d133aec5dc882cf783a293f393bfb3f4379e1 (patch)
tree41fc56a4aaec8892a235ffd530b36278d147dc4e /tools/perf/builtin-report.c
parent7cc017edb9459193d3b581155a14029e4bef0c49 (diff)
perf symbols: Simplify symbol machinery setup
And also express its configuration toggles via a struct. Now all one has to do is to call symbol__init(NULL) if the defaults are OK, or pass a struct symbol_conf pointer with the desired configuration. If a tool uses kernel_maps__find_symbol() to look at the kernel and modules mappings for a symbol but didn't call symbol__init() first, that will generate a one time warning too, alerting the subcommand developer that symbol__init() must be called. 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: <1259071517-3242-2-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1826be719b58..0ee3d05a0409 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -39,7 +39,6 @@ static char *dso_list_str, *comm_list_str, *sym_list_str,
39static struct strlist *dso_list, *comm_list, *sym_list; 39static struct strlist *dso_list, *comm_list, *sym_list;
40 40
41static int force; 41static int force;
42static bool use_modules;
43 42
44static int full_paths; 43static int full_paths;
45static int show_nr_samples; 44static int show_nr_samples;
@@ -53,12 +52,13 @@ static char *pretty_printing_style = default_pretty_printing_style;
53static int exclude_other = 1; 52static int exclude_other = 1;
54 53
55static char callchain_default_opt[] = "fractal,0.5"; 54static char callchain_default_opt[] = "fractal,0.5";
56const char *vmlinux_name;
57 55
58static struct perf_header *header; 56static struct perf_header *header;
59 57
60static u64 sample_type; 58static u64 sample_type;
61 59
60struct symbol_conf symbol_conf;
61
62 62
63static size_t 63static size_t
64callchain__fprintf_left_margin(FILE *fp, int left_margin) 64callchain__fprintf_left_margin(FILE *fp, int left_margin)
@@ -865,8 +865,7 @@ static int __cmd_report(void)
865 865
866 register_perf_file_handler(&file_handler); 866 register_perf_file_handler(&file_handler);
867 867
868 ret = mmap_dispatch_perf_file(&header, input_name, vmlinux_name, 868 ret = mmap_dispatch_perf_file(&header, input_name, force,
869 !vmlinux_name, force,
870 full_paths, &cwdlen, &cwd); 869 full_paths, &cwdlen, &cwd);
871 if (ret) 870 if (ret)
872 return ret; 871 return ret;
@@ -963,9 +962,10 @@ static const struct option options[] = {
963 "be more verbose (show symbol address, etc)"), 962 "be more verbose (show symbol address, etc)"),
964 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, 963 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
965 "dump raw trace in ASCII"), 964 "dump raw trace in ASCII"),
966 OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), 965 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
966 "file", "vmlinux pathname"),
967 OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), 967 OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
968 OPT_BOOLEAN('m', "modules", &use_modules, 968 OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
969 "load module symbols - WARNING: use only with -k and LIVE kernel"), 969 "load module symbols - WARNING: use only with -k and LIVE kernel"),
970 OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, 970 OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,
971 "Show a column with the number of samples"), 971 "Show a column with the number of samples"),
@@ -1035,7 +1035,8 @@ static void setup_list(struct strlist **list, const char *list_str,
1035 1035
1036int cmd_report(int argc, const char **argv, const char *prefix __used) 1036int cmd_report(int argc, const char **argv, const char *prefix __used)
1037{ 1037{
1038 symbol__init(0); 1038 if (symbol__init(&symbol_conf) < 0)
1039 return -1;
1039 1040
1040 argc = parse_options(argc, argv, options, report_usage, 0); 1041 argc = parse_options(argc, argv, options, report_usage, 0);
1041 1042