diff options
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f14cb5fdb91f..e9231659754d 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -31,15 +31,6 @@ | |||
31 | #include <sched.h> | 31 | #include <sched.h> |
32 | #include <sys/mman.h> | 32 | #include <sys/mman.h> |
33 | 33 | ||
34 | #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " | ||
35 | |||
36 | #ifdef NO_LIBUNWIND_SUPPORT | ||
37 | static char callchain_help[] = CALLCHAIN_HELP "[fp]"; | ||
38 | #else | ||
39 | static unsigned long default_stack_dump_size = 8192; | ||
40 | static char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; | ||
41 | #endif | ||
42 | |||
43 | enum write_mode_t { | 34 | enum write_mode_t { |
44 | WRITE_FORCE, | 35 | WRITE_FORCE, |
45 | WRITE_APPEND | 36 | WRITE_APPEND |
@@ -800,7 +791,7 @@ error: | |||
800 | return ret; | 791 | return ret; |
801 | } | 792 | } |
802 | 793 | ||
803 | #ifndef NO_LIBUNWIND_SUPPORT | 794 | #ifdef LIBUNWIND_SUPPORT |
804 | static int get_stack_size(char *str, unsigned long *_size) | 795 | static int get_stack_size(char *str, unsigned long *_size) |
805 | { | 796 | { |
806 | char *endptr; | 797 | char *endptr; |
@@ -826,7 +817,7 @@ static int get_stack_size(char *str, unsigned long *_size) | |||
826 | max_size, str); | 817 | max_size, str); |
827 | return -1; | 818 | return -1; |
828 | } | 819 | } |
829 | #endif /* !NO_LIBUNWIND_SUPPORT */ | 820 | #endif /* LIBUNWIND_SUPPORT */ |
830 | 821 | ||
831 | static int | 822 | static int |
832 | parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, | 823 | parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, |
@@ -865,9 +856,11 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, | |||
865 | "needed for -g fp\n"); | 856 | "needed for -g fp\n"); |
866 | break; | 857 | break; |
867 | 858 | ||
868 | #ifndef NO_LIBUNWIND_SUPPORT | 859 | #ifdef LIBUNWIND_SUPPORT |
869 | /* Dwarf style */ | 860 | /* Dwarf style */ |
870 | } else if (!strncmp(name, "dwarf", sizeof("dwarf"))) { | 861 | } else if (!strncmp(name, "dwarf", sizeof("dwarf"))) { |
862 | const unsigned long default_stack_dump_size = 8192; | ||
863 | |||
871 | ret = 0; | 864 | ret = 0; |
872 | rec->opts.call_graph = CALLCHAIN_DWARF; | 865 | rec->opts.call_graph = CALLCHAIN_DWARF; |
873 | rec->opts.stack_dump_size = default_stack_dump_size; | 866 | rec->opts.stack_dump_size = default_stack_dump_size; |
@@ -883,7 +876,7 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, | |||
883 | if (!ret) | 876 | if (!ret) |
884 | pr_debug("callchain: stack dump size %d\n", | 877 | pr_debug("callchain: stack dump size %d\n", |
885 | rec->opts.stack_dump_size); | 878 | rec->opts.stack_dump_size); |
886 | #endif /* !NO_LIBUNWIND_SUPPORT */ | 879 | #endif /* LIBUNWIND_SUPPORT */ |
887 | } else { | 880 | } else { |
888 | pr_err("callchain: Unknown -g option " | 881 | pr_err("callchain: Unknown -g option " |
889 | "value: %s\n", arg); | 882 | "value: %s\n", arg); |
@@ -930,6 +923,14 @@ static struct perf_record record = { | |||
930 | .file_new = true, | 923 | .file_new = true, |
931 | }; | 924 | }; |
932 | 925 | ||
926 | #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " | ||
927 | |||
928 | #ifdef LIBUNWIND_SUPPORT | ||
929 | static const char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; | ||
930 | #else | ||
931 | static const char callchain_help[] = CALLCHAIN_HELP "[fp]"; | ||
932 | #endif | ||
933 | |||
933 | /* | 934 | /* |
934 | * XXX Will stay a global variable till we fix builtin-script.c to stop messing | 935 | * XXX Will stay a global variable till we fix builtin-script.c to stop messing |
935 | * with it and switch to use the library functions in perf_evlist that came | 936 | * with it and switch to use the library functions in perf_evlist that came |