aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/Documentation/perf-top.txt8
-rw-r--r--tools/perf/builtin-top.c8
-rw-r--r--tools/perf/util/top.h1
3 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index f65777c1f723..c16a09e2f182 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -158,6 +158,14 @@ Default is to monitor all CPUS.
158 158
159 Default: fractal,0.5,callee. 159 Default: fractal,0.5,callee.
160 160
161--max-stack::
162 Set the stack depth limit when parsing the callchain, anything
163 beyond the specified depth will be ignored. This is a trade-off
164 between information loss and faster processing especially for
165 workloads that can have a very long callchain stack.
166
167 Default: 127
168
161--ignore-callees=<regex>:: 169--ignore-callees=<regex>::
162 Ignore callees of the function(s) matching the given regex. 170 Ignore callees of the function(s) matching the given regex.
163 This has the effect of collecting the callers of each such 171 This has the effect of collecting the callers of each such
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 112cb7d68e64..386d83324a8d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -771,7 +771,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
771 err = machine__resolve_callchain(machine, evsel, 771 err = machine__resolve_callchain(machine, evsel,
772 al.thread, sample, 772 al.thread, sample,
773 &parent, &al, 773 &parent, &al,
774 PERF_MAX_STACK_DEPTH); 774 top->max_stack);
775 if (err) 775 if (err)
776 return; 776 return;
777 } 777 }
@@ -1048,10 +1048,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1048 .user_freq = UINT_MAX, 1048 .user_freq = UINT_MAX,
1049 .user_interval = ULLONG_MAX, 1049 .user_interval = ULLONG_MAX,
1050 .freq = 4000, /* 4 KHz */ 1050 .freq = 4000, /* 4 KHz */
1051 .target = { 1051 .target = {
1052 .uses_mmap = true, 1052 .uses_mmap = true,
1053 }, 1053 },
1054 }, 1054 },
1055 .max_stack = PERF_MAX_STACK_DEPTH,
1055 .sym_pcnt_filter = 5, 1056 .sym_pcnt_filter = 5,
1056 }; 1057 };
1057 struct perf_record_opts *opts = &top.record_opts; 1058 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)
1110 OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts, 1111 OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts,
1111 "mode[,dump_size]", record_callchain_help, 1112 "mode[,dump_size]", record_callchain_help,
1112 &parse_callchain_opt, "fp"), 1113 &parse_callchain_opt, "fp"),
1114 OPT_INTEGER(0, "max-stack", &top.max_stack,
1115 "Set the maximum stack depth when parsing the callchain. "
1116 "Default: " __stringify(PERF_MAX_STACK_DEPTH)),
1113 OPT_CALLBACK(0, "ignore-callees", NULL, "regex", 1117 OPT_CALLBACK(0, "ignore-callees", NULL, "regex",
1114 "ignore callees of these functions in call graphs", 1118 "ignore callees of these functions in call graphs",
1115 report_parse_ignore_callees_opt), 1119 report_parse_ignore_callees_opt),
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index b554ffc462b6..88cfeaff600b 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -24,6 +24,7 @@ struct perf_top {
24 u64 exact_samples; 24 u64 exact_samples;
25 u64 guest_us_samples, guest_kernel_samples; 25 u64 guest_us_samples, guest_kernel_samples;
26 int print_entries, count_filter, delay_secs; 26 int print_entries, count_filter, delay_secs;
27 int max_stack;
27 bool hide_kernel_symbols, hide_user_symbols, zero; 28 bool hide_kernel_symbols, hide_user_symbols, zero;
28 bool use_tui, use_stdio; 29 bool use_tui, use_stdio;
29 bool kptr_restrict_warned; 30 bool kptr_restrict_warned;