perf script: Add --max-stack knob
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 14 Apr 2016 21:15:18 +0000 (18:15 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 14 Apr 2016 22:46:57 +0000 (19:46 -0300)
Works just like with 'perf report'. In some cases we may want to have
more than 127 entries, the default maximum.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-mqkz2p5ok2978gztb0vsnocc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Documentation/perf-script.txt
tools/perf/builtin-script.c

index 22ef3933342adcac3ba298bc685b8ac7da2f2bf1..4fc44c75263fdb803315394e8353d77063f69e6a 100644 (file)
@@ -259,6 +259,16 @@ include::itrace.txt[]
 --full-source-path::
        Show the full path for source files for srcline output.
 
+--max-stack::
+        Set the stack depth limit when parsing the callchain, anything
+        beyond the specified depth will be ignored. This is a trade-off
+        between information loss and faster processing especially for
+        workloads that can have a very long callchain stack.
+        Note that when using the --itrace option the synthesized callchain size
+        will override this value if the synthesized callchain size is bigger.
+
+        Default: 127
+
 --ns::
        Use 9 decimal places when displaying time (i.e. show the nanoseconds)
 
index 875d84e7ba5ba27bc263a61473f2d3142b5794f7..0e93282b405ed11476b58cf62a486f0a87e63261 100644 (file)
@@ -22,6 +22,7 @@
 #include "util/thread_map.h"
 #include "util/stat.h"
 #include <linux/bitmap.h>
+#include <linux/stringify.h>
 #include "asm/bug.h"
 #include "util/mem-events.h"
 
@@ -2027,6 +2028,10 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
                   "only consider symbols in these pids"),
        OPT_STRING(0, "tid", &symbol_conf.tid_list_str, "tid[,tid...]",
                   "only consider symbols in these tids"),
+       OPT_UINTEGER(0, "max-stack", &scripting_max_stack,
+                    "Set the maximum stack depth when parsing the callchain, "
+                    "anything beyond the specified depth will be ignored. "
+                    "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
        OPT_BOOLEAN('I', "show-info", &show_full_info,
                    "display extended information from perf.data file"),
        OPT_BOOLEAN('\0', "show-kernel-path", &symbol_conf.show_kernel_path,