summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/callchain.c
diff options
context:
space:
mode:
authorKan Liang <kan.liang@intel.com>2015-08-04 04:30:20 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-08-05 16:42:11 -0300
commitc3a6a8c40538f609923acf9473250266283269a5 (patch)
tree45cbe3f333405aa0f2721f6b61579b80a0246750 /tools/perf/util/callchain.c
parent320677123905fd1dd122895cd5fb870ee9e1380b (diff)
downloadlinux-c3a6a8c40538f609923acf9473250266283269a5.tar.gz
linux-c3a6a8c40538f609923acf9473250266283269a5.tar.bz2
linux-c3a6a8c40538f609923acf9473250266283269a5.zip
perf tools: Refine parse/config callchain functions
Pass global callchain_param into parse_callchain_record_opt and perf_evsel__config_callgraph as parameter. So we can reuse these functions to parse/config local param for callchain. Signed-off-by: Kan Liang <kan.liang@intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1438677022-34296-3-git-send-email-kan.liang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r--tools/perf/util/callchain.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 9f643ee77001..931cca8e6ae8 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -53,7 +53,7 @@ static int get_stack_size(const char *str, unsigned long *_size)
}
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
-int parse_callchain_record_opt(const char *arg)
+int parse_callchain_record_opt(const char *arg, struct callchain_param *param)
{
char *tok, *name, *saveptr = NULL;
char *buf;
@@ -73,7 +73,7 @@ int parse_callchain_record_opt(const char *arg)
/* Framepointer style */
if (!strncmp(name, "fp", sizeof("fp"))) {
if (!strtok_r(NULL, ",", &saveptr)) {
- callchain_param.record_mode = CALLCHAIN_FP;
+ param->record_mode = CALLCHAIN_FP;
ret = 0;
} else
pr_err("callchain: No more arguments "
@@ -86,20 +86,20 @@ int parse_callchain_record_opt(const char *arg)
const unsigned long default_stack_dump_size = 8192;
ret = 0;
- callchain_param.record_mode = CALLCHAIN_DWARF;
- callchain_param.dump_size = default_stack_dump_size;
+ param->record_mode = CALLCHAIN_DWARF;
+ param->dump_size = default_stack_dump_size;
tok = strtok_r(NULL, ",", &saveptr);
if (tok) {
unsigned long size = 0;
ret = get_stack_size(tok, &size);
- callchain_param.dump_size = size;
+ param->dump_size = size;
}
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
} else if (!strncmp(name, "lbr", sizeof("lbr"))) {
if (!strtok_r(NULL, ",", &saveptr)) {
- callchain_param.record_mode = CALLCHAIN_LBR;
+ param->record_mode = CALLCHAIN_LBR;
ret = 0;
} else
pr_err("callchain: No more arguments "
@@ -219,7 +219,7 @@ int perf_callchain_config(const char *var, const char *value)
var += sizeof("call-graph.") - 1;
if (!strcmp(var, "record-mode"))
- return parse_callchain_record_opt(value);
+ return parse_callchain_record_opt(value, &callchain_param);
#ifdef HAVE_DWARF_UNWIND_SUPPORT
if (!strcmp(var, "dump-size")) {
unsigned long size = 0;