diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-01 14:20:58 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-02 17:36:40 -0400 |
commit | 61eaa3be152afcbfb862a10f81341f96371c3ce3 (patch) | |
tree | 3d7979898a5b44050bb02be45c7bad518219a1ff /tools/perf/builtin-record.c | |
parent | 94d668d0732d469e3237da0990b3512dc0f23d09 (diff) |
perf record: Don't use globals where not needed to
Some variables were global but used in just one function, so move it to
where it belongs.
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-2ce3v9qheiobs3sz6pxf4tud@git.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 | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 8c029fe2e22c..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 LIBUNWIND_SUPPORT | ||
37 | static unsigned long default_stack_dump_size = 8192; | ||
38 | static char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; | ||
39 | #else | ||
40 | static char callchain_help[] = CALLCHAIN_HELP "[fp]"; | ||
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 |
@@ -868,6 +859,8 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, | |||
868 | #ifdef 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; |
@@ -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 |