aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:20:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:20:11 -0400
commitade0899b298ba2c43bfd6abd8cbc2545944cde0c (patch)
treea448dfb440b3b958b6306bb43620cd5d76f504bf /tools/perf/builtin-record.c
parent871a0596cb2f51b57dc583d1a7c4be0186582fe7 (diff)
parent95cf59ea72331d0093010543b8951bb43f262cac (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar: "This tree includes some late late perf items that missed the first round: tools: - Bash auto completion improvements, now we can auto complete the tools long options, tracepoint event names, etc, from Namhyung Kim. - Look up thread using tid instead of pid in 'perf sched'. - Move global variables into a perf_kvm struct, from David Ahern. - Hists refactorings, preparatory for improved 'diff' command, from Jiri Olsa. - Hists refactorings, preparatory for event group viewieng work, from Namhyung Kim. - Remove double negation on optional feature macro definitions, from Namhyung Kim. - Remove several cases of needless global variables, on most builtins. - misc fixes kernel: - sysfs support for IBS on AMD CPUs, from Robert Richter. - Support for an upcoming Intel CPU, the Xeon-Phi / Knights Corner HPC blade PMU, from Vince Weaver. - misc fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) perf: Fix perf_cgroup_switch for sw-events perf: Clarify perf_cpu_context::active_pmu usage by renaming it to ::unique_pmu perf/AMD/IBS: Add sysfs support perf hists: Add more helpers for hist entry stat perf hists: Move he->stat.nr_events initialization to a template perf hists: Introduce struct he_stat perf diff: Removing the total_period argument from output code perf tool: Add hpp interface to enable/disable hpp column perf tools: Removing hists pair argument from output path perf hists: Separate overhead and baseline columns perf diff: Refactor diff displacement possition info perf hists: Add struct hists pointer to struct hist_entry perf tools: Complete tracepoint event names perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU perf evlist: Remove some unused methods perf evlist: Introduce add_newtp method perf kvm: Move global variables into a perf_kvm struct perf tools: Convert to BACKTRACE_SUPPORT perf tools: Long option completion support for each subcommands perf tools: Complete long option names of perf command ...
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c27
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
37static char callchain_help[] = CALLCHAIN_HELP "[fp]";
38#else
39static unsigned long default_stack_dump_size = 8192;
40static char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
41#endif
42
43enum write_mode_t { 34enum 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
804static int get_stack_size(char *str, unsigned long *_size) 795static 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
831static int 822static int
832parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, 823parse_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
929static const char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
930#else
931static 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