]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/perf/builtin-top.c
perf top: Add --max-stack option to limit callchain stack scan
[karo-tx-linux.git] / tools / perf / builtin-top.c
index 112cb7d68e649beac8b760015119908b1ae5bbea..386d83324a8d0d519800c8b3cba7a6b5defa95f5 100644 (file)
@@ -771,7 +771,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
                        err = machine__resolve_callchain(machine, evsel,
                                                         al.thread, sample,
                                                         &parent, &al,
-                                                        PERF_MAX_STACK_DEPTH);
+                                                        top->max_stack);
                        if (err)
                                return;
                }
@@ -1048,10 +1048,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
                        .user_freq      = UINT_MAX,
                        .user_interval  = ULLONG_MAX,
                        .freq           = 4000, /* 4 KHz */
-                       .target              = {
+                       .target         = {
                                .uses_mmap   = true,
                        },
                },
+               .max_stack           = PERF_MAX_STACK_DEPTH,
                .sym_pcnt_filter     = 5,
        };
        struct perf_record_opts *opts = &top.record_opts;
@@ -1110,6 +1111,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
        OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts,
                             "mode[,dump_size]", record_callchain_help,
                             &parse_callchain_opt, "fp"),
+       OPT_INTEGER(0, "max-stack", &top.max_stack,
+                   "Set the maximum stack depth when parsing the callchain. "
+                   "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
        OPT_CALLBACK(0, "ignore-callees", NULL, "regex",
                   "ignore callees of these functions in call graphs",
                   report_parse_ignore_callees_opt),