Skip to content

Commit 61eaa3b

Browse files
committed
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 <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 94d668d commit 61eaa3b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tools/perf/builtin-record.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@
3131
#include <sched.h>
3232
#include <sys/mman.h>
3333

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-
4334
enum write_mode_t {
4435
WRITE_FORCE,
4536
WRITE_APPEND
@@ -868,6 +859,8 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
868859
#ifdef LIBUNWIND_SUPPORT
869860
/* Dwarf style */
870861
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
862+
const unsigned long default_stack_dump_size = 8192;
863+
871864
ret = 0;
872865
rec->opts.call_graph = CALLCHAIN_DWARF;
873866
rec->opts.stack_dump_size = default_stack_dump_size;
@@ -930,6 +923,14 @@ static struct perf_record record = {
930923
.file_new = true,
931924
};
932925

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+
933934
/*
934935
* XXX Will stay a global variable till we fix builtin-script.c to stop messing
935936
* with it and switch to use the library functions in perf_evlist that came

0 commit comments

Comments
 (0)