From: Arnaldo Carvalho de Melo Date: Mon, 1 Oct 2012 18:20:58 +0000 (-0300) Subject: perf record: Don't use globals where not needed to X-Git-Tag: upstream/snapshot3+hdmi~6017^2~41^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61eaa3be152afcbfb862a10f81341f96371c3ce3;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-2ce3v9qheiobs3sz6pxf4tud@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 8c029fe..e9231659 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -31,15 +31,6 @@ #include #include -#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 { WRITE_FORCE, WRITE_APPEND @@ -868,6 +859,8 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, #ifdef LIBUNWIND_SUPPORT /* Dwarf style */ } else if (!strncmp(name, "dwarf", sizeof("dwarf"))) { + const unsigned long default_stack_dump_size = 8192; + ret = 0; rec->opts.call_graph = CALLCHAIN_DWARF; rec->opts.stack_dump_size = default_stack_dump_size; @@ -930,6 +923,14 @@ static struct perf_record record = { .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 * with it and switch to use the library functions in perf_evlist that came