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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 94d668d0
...@@ -31,15 +31,6 @@ ...@@ -31,15 +31,6 @@
#include <sched.h> #include <sched.h>
#include <sys/mman.h> #include <sys/mman.h>
#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
#ifdef LIBUNWIND_SUPPORT
static unsigned long default_stack_dump_size = 8192;
static char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
#else
static char callchain_help[] = CALLCHAIN_HELP "[fp]";
#endif
enum write_mode_t { enum write_mode_t {
WRITE_FORCE, WRITE_FORCE,
WRITE_APPEND WRITE_APPEND
...@@ -868,6 +859,8 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, ...@@ -868,6 +859,8 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
#ifdef LIBUNWIND_SUPPORT #ifdef LIBUNWIND_SUPPORT
/* Dwarf style */ /* Dwarf style */
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) { } else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
const unsigned long default_stack_dump_size = 8192;
ret = 0; ret = 0;
rec->opts.call_graph = CALLCHAIN_DWARF; rec->opts.call_graph = CALLCHAIN_DWARF;
rec->opts.stack_dump_size = default_stack_dump_size; rec->opts.stack_dump_size = default_stack_dump_size;
...@@ -930,6 +923,14 @@ static struct perf_record record = { ...@@ -930,6 +923,14 @@ static struct perf_record record = {
.file_new = true, .file_new = true,
}; };
#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
#ifdef LIBUNWIND_SUPPORT
static const char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
#else
static const char callchain_help[] = CALLCHAIN_HELP "[fp]";
#endif
/* /*
* XXX Will stay a global variable till we fix builtin-script.c to stop messing * XXX Will stay a global variable till we fix builtin-script.c to stop messing
* with it and switch to use the library functions in perf_evlist that came * with it and switch to use the library functions in perf_evlist that came
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment