aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-12-11 14:46:05 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-12-11 15:22:14 -0500
commit75d9a10854db6aab2400cd6a844c392107be4c64 (patch)
tree6c0a3db48bc2426e4e3c49edfdc72014664fab13 /tools
parentc5ff78c3092d0e7d14c82d2949e16fee063a83f1 (diff)
perf record: Export the callchain parsing routine and help
Will be used by perf top, that will first setup the symbol system to deal with callchains and then call these routines to ask the kernel for callchains. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-jg0dh8rmlx7x11e7u7mnasvd@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-record.c11
-rw-r--r--tools/perf/util/callchain.h5
2 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d035040efe1d..028de726b832 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -868,7 +868,8 @@ static int get_stack_size(char *str, unsigned long *_size)
868} 868}
869#endif /* LIBUNWIND_SUPPORT */ 869#endif /* LIBUNWIND_SUPPORT */
870 870
871static int parse_callchain_opt(const struct option *opt, const char *arg, int unset) 871int record_parse_callchain_opt(const struct option *opt,
872 const char *arg, int unset)
872{ 873{
873 struct perf_record_opts *opts = opt->value; 874 struct perf_record_opts *opts = opt->value;
874 char *tok, *name, *saveptr = NULL; 875 char *tok, *name, *saveptr = NULL;
@@ -973,9 +974,9 @@ static struct perf_record record = {
973#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " 974#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
974 975
975#ifdef LIBUNWIND_SUPPORT 976#ifdef LIBUNWIND_SUPPORT
976static const char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; 977const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
977#else 978#else
978static const char callchain_help[] = CALLCHAIN_HELP "[fp]"; 979const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
979#endif 980#endif
980 981
981/* 982/*
@@ -1020,8 +1021,8 @@ const struct option record_options[] = {
1020 OPT_BOOLEAN(0, "group", &record.opts.group, 1021 OPT_BOOLEAN(0, "group", &record.opts.group,
1021 "put the counters into a counter group"), 1022 "put the counters into a counter group"),
1022 OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts, 1023 OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts,
1023 "mode[,dump_size]", callchain_help, 1024 "mode[,dump_size]", record_callchain_help,
1024 &parse_callchain_opt, "fp"), 1025 &record_parse_callchain_opt, "fp"),
1025 OPT_INCR('v', "verbose", &verbose, 1026 OPT_INCR('v', "verbose", &verbose,
1026 "be more verbose (show counter open errors, etc)"), 1027 "be more verbose (show counter open errors, etc)"),
1027 OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), 1028 OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index eb340571e7d6..3ee9f67d5af0 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -143,4 +143,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
143 cursor->curr = cursor->curr->next; 143 cursor->curr = cursor->curr->next;
144 cursor->pos++; 144 cursor->pos++;
145} 145}
146
147struct option;
148
149int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset);
150extern const char record_callchain_help[];
146#endif /* __PERF_CALLCHAIN_H */ 151#endif /* __PERF_CALLCHAIN_H */