Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf trace: Add --max-stack knob

Similar to the one in the other tools (report, script, top).

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-lh7kk5a5t3erwxw31ah0cgar@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+17 -1
+9
tools/perf/Documentation/perf-trace.txt
··· 129 129 --event:: 130 130 Trace other events, see 'perf list' for a complete list. 131 131 132 + --max-stack:: 133 + Set the stack depth limit when parsing the callchain, anything 134 + beyond the specified depth will be ignored. Note that at this point 135 + this is just about the presentation part, i.e. the kernel is still 136 + not limiting, the overhead of callchains needs to be set via the 137 + knobs in --call-graph dwarf. 138 + 139 + Default: 127 140 + 132 141 --proc-map-timeout:: 133 142 When processing pre-existing threads /proc/XXX/mmap, it may take a long time, 134 143 because the file may be huge. A time out is needed in such cases.
+8 -1
tools/perf/builtin-trace.c
··· 46 46 #include <linux/audit.h> 47 47 #include <sys/ptrace.h> 48 48 #include <linux/random.h> 49 + #include <linux/stringify.h> 49 50 50 51 #ifndef O_CLOEXEC 51 52 # define O_CLOEXEC 02000000 ··· 107 106 u64 vfs_getname, 108 107 proc_getname; 109 108 } stats; 109 + unsigned int max_stack; 110 110 bool not_ev_qualifier; 111 111 bool live; 112 112 bool full_time; ··· 1894 1892 1895 1893 if (machine__resolve(trace->host, &al, sample) < 0 || 1896 1894 thread__resolve_callchain(al.thread, &callchain_cursor, evsel, 1897 - sample, NULL, NULL, scripting_max_stack)) { 1895 + sample, NULL, NULL, trace->max_stack)) { 1898 1896 pr_err("Problem processing %s callchain, skipping...\n", 1899 1897 perf_evsel__name(evsel)); 1900 1898 return 0; ··· 3031 3029 .show_comm = true, 3032 3030 .trace_syscalls = true, 3033 3031 .kernel_syscallchains = false, 3032 + .max_stack = PERF_MAX_STACK_DEPTH, 3034 3033 }; 3035 3034 const char *output_name = NULL; 3036 3035 const char *ev_qualifier_str = NULL; ··· 3082 3079 &record_parse_callchain_opt), 3083 3080 OPT_BOOLEAN(0, "kernel-syscall-graph", &trace.kernel_syscallchains, 3084 3081 "Show the kernel callchains on the syscall exit path"), 3082 + OPT_UINTEGER(0, "max-stack", &trace.max_stack, 3083 + "Set the maximum stack depth when parsing the callchain, " 3084 + "anything beyond the specified depth will be ignored. " 3085 + "Default: " __stringify(PERF_MAX_STACK_DEPTH)), 3085 3086 OPT_UINTEGER(0, "proc-map-timeout", &trace.opts.proc_map_timeout, 3086 3087 "per thread proc mmap processing timeout in ms"), 3087 3088 OPT_END()