diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-09-23 01:01:41 (GMT) |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-09-26 15:40:33 (GMT) |
commit | 72a128aa083a7f4cc4f800718aaae05d9c698e26 (patch) | |
tree | 9ae890a7d8bc073bca3d23159aa96562c7422e46 /tools/perf/builtin-record.c | |
parent | 72f72ed21e56c386dd92118e5da3ce06752b1614 (diff) | |
download | linux-72a128aa083a7f4cc4f800718aaae05d9c698e26.tar.xz |
perf tools: Move callchain config from record_opts to callchain_param
So that all callchain config parameters can be read/written to a single
place. It's a preparation to consolidate handling of all callchain
options.
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Milian Wolff <mail@milianw.de>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1411434104-5307-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 320b198..fde0df7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -652,7 +652,7 @@ static int get_stack_size(char *str, unsigned long *_size) } #endif /* HAVE_DWARF_UNWIND_SUPPORT */ -int record_parse_callchain(const char *arg, struct record_opts *opts) +int record_parse_callchain(const char *arg) { char *tok, *name, *saveptr = NULL; char *buf; @@ -672,7 +672,7 @@ int record_parse_callchain(const char *arg, struct record_opts *opts) /* Framepointer style */ if (!strncmp(name, "fp", sizeof("fp"))) { if (!strtok_r(NULL, ",", &saveptr)) { - opts->call_graph = CALLCHAIN_FP; + callchain_param.record_mode = CALLCHAIN_FP; ret = 0; } else pr_err("callchain: No more arguments " @@ -685,15 +685,15 @@ int record_parse_callchain(const char *arg, struct record_opts *opts) const unsigned long default_stack_dump_size = 8192; ret = 0; - opts->call_graph = CALLCHAIN_DWARF; - opts->stack_dump_size = default_stack_dump_size; + callchain_param.record_mode = CALLCHAIN_DWARF; + callchain_param.dump_size = default_stack_dump_size; tok = strtok_r(NULL, ",", &saveptr); if (tok) { unsigned long size = 0; ret = get_stack_size(tok, &size); - opts->stack_dump_size = size; + callchain_param.dump_size = size; } #endif /* HAVE_DWARF_UNWIND_SUPPORT */ } else { @@ -708,61 +708,56 @@ int record_parse_callchain(const char *arg, struct record_opts *opts) return ret; } -static void callchain_debug(struct record_opts *opts) +static void callchain_debug(void) { static const char *str[CALLCHAIN_MAX] = { "NONE", "FP", "DWARF" }; - pr_debug("callchain: type %s\n", str[opts->call_graph]); + pr_debug("callchain: type %s\n", str[callchain_param.record_mode]); - if (opts->call_graph == CALLCHAIN_DWARF) + if (callchain_param.record_mode == CALLCHAIN_DWARF) pr_debug("callchain: stack dump size %d\n", - opts->stack_dump_size); + callchain_param.dump_size); } -int record_parse_callchain_opt(const struct option *opt, +int record_parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, int unset) { - struct record_opts *opts = opt->value; int ret; - opts->call_graph_enabled = !unset; + callchain_param.enabled = !unset; /* --no-call-graph */ if (unset) { - opts->call_graph = CALLCHAIN_NONE; + callchain_param.record_mode = CALLCHAIN_NONE; pr_debug("callchain: disabled\n"); return 0; } - ret = record_parse_callchain(arg, opts); + ret = record_parse_callchain(arg); if (!ret) - callchain_debug(opts); + callchain_debug(); return ret; } -int record_callchain_opt(const struct option *opt, +int record_callchain_opt(const struct option *opt __maybe_unused, const char *arg __maybe_unused, int unset __maybe_unused) { - struct record_opts *opts = opt->value; + callchain_param.enabled = true; - opts->call_graph_enabled = !unset; + if (callchain_param.record_mode == CALLCHAIN_NONE) + callchain_param.record_mode = CALLCHAIN_FP; - if (opts->call_graph == CALLCHAIN_NONE) - opts->call_graph = CALLCHAIN_FP; - - callchain_debug(opts); + callchain_debug(); return 0; } static int perf_record_config(const char *var, const char *value, void *cb) { - struct record *rec = cb; - if (!strcmp(var, "record.call-graph")) - return record_parse_callchain(value, &rec->opts); + return record_parse_callchain(value); return perf_default_config(var, value, cb); } |