aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-top.txt4
-rw-r--r--tools/perf/builtin-top.c17
-rw-r--r--tools/perf/ui/browsers/hists.c16
-rw-r--r--tools/perf/util/top.h1
4 files changed, 34 insertions, 4 deletions
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index 9f1a2fe54757..7fdd1909e376 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -155,6 +155,10 @@ Default is to monitor all CPUS.
155 155
156 Default: fractal,0.5,callee. 156 Default: fractal,0.5,callee.
157 157
158--percent-limit::
159 Do not show entries which have an overhead under that percent.
160 (Default: 0).
161
158INTERACTIVE PROMPTING KEYS 162INTERACTIVE PROMPTING KEYS
159-------------------------- 163--------------------------
160 164
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 19fe25f6e4f0..f036af9b6f09 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -296,7 +296,8 @@ static void perf_top__print_sym_table(struct perf_top *top)
296 top->print_entries - printed); 296 top->print_entries - printed);
297 putchar('\n'); 297 putchar('\n');
298 hists__fprintf(&top->sym_evsel->hists, false, 298 hists__fprintf(&top->sym_evsel->hists, false,
299 top->print_entries - printed, win_width, 0, stdout); 299 top->print_entries - printed, win_width,
300 top->min_percent, stdout);
300} 301}
301 302
302static void prompt_integer(int *target, const char *msg) 303static void prompt_integer(int *target, const char *msg)
@@ -580,7 +581,7 @@ static void *display_thread_tui(void *arg)
580 list_for_each_entry(pos, &top->evlist->entries, node) 581 list_for_each_entry(pos, &top->evlist->entries, node)
581 pos->hists.uid_filter_str = top->record_opts.target.uid_str; 582 pos->hists.uid_filter_str = top->record_opts.target.uid_str;
582 583
583 perf_evlist__tui_browse_hists(top->evlist, help, &hbt, 0, 584 perf_evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent,
584 &top->session->header.env); 585 &top->session->header.env);
585 586
586 done = 1; 587 done = 1;
@@ -1021,6 +1022,16 @@ parse_callchain_opt(const struct option *opt, const char *arg, int unset)
1021 return record_parse_callchain_opt(opt, arg, unset); 1022 return record_parse_callchain_opt(opt, arg, unset);
1022} 1023}
1023 1024
1025static int
1026parse_percent_limit(const struct option *opt, const char *arg,
1027 int unset __maybe_unused)
1028{
1029 struct perf_top *top = opt->value;
1030
1031 top->min_percent = strtof(arg, NULL);
1032 return 0;
1033}
1034
1024int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) 1035int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1025{ 1036{
1026 int status; 1037 int status;
@@ -1106,6 +1117,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1106 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style", 1117 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
1107 "Specify disassembler style (e.g. -M intel for intel syntax)"), 1118 "Specify disassembler style (e.g. -M intel for intel syntax)"),
1108 OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), 1119 OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
1120 OPT_CALLBACK(0, "percent-limit", &top, "percent",
1121 "Don't show entries under that percent", parse_percent_limit),
1109 OPT_END() 1122 OPT_END()
1110 }; 1123 };
1111 const char * const top_usage[] = { 1124 const char * const top_usage[] = {
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 9dfde61505cc..fc0bd3843d34 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -310,6 +310,8 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser)
310 "Or reduce the sampling frequency."); 310 "Or reduce the sampling frequency.");
311} 311}
312 312
313static void hist_browser__update_pcnt_entries(struct hist_browser *hb);
314
313static int hist_browser__run(struct hist_browser *browser, const char *ev_name, 315static int hist_browser__run(struct hist_browser *browser, const char *ev_name,
314 struct hist_browser_timer *hbt) 316 struct hist_browser_timer *hbt)
315{ 317{
@@ -333,9 +335,18 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name,
333 key = ui_browser__run(&browser->b, delay_secs); 335 key = ui_browser__run(&browser->b, delay_secs);
334 336
335 switch (key) { 337 switch (key) {
336 case K_TIMER: 338 case K_TIMER: {
339 u64 nr_entries;
337 hbt->timer(hbt->arg); 340 hbt->timer(hbt->arg);
338 ui_browser__update_nr_entries(&browser->b, browser->hists->nr_entries); 341
342 if (browser->min_pcnt) {
343 hist_browser__update_pcnt_entries(browser);
344 nr_entries = browser->nr_pcnt_entries;
345 } else {
346 nr_entries = browser->hists->nr_entries;
347 }
348
349 ui_browser__update_nr_entries(&browser->b, nr_entries);
339 350
340 if (browser->hists->stats.nr_lost_warned != 351 if (browser->hists->stats.nr_lost_warned !=
341 browser->hists->stats.nr_events[PERF_RECORD_LOST]) { 352 browser->hists->stats.nr_events[PERF_RECORD_LOST]) {
@@ -347,6 +358,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name,
347 hists__browser_title(browser->hists, title, sizeof(title), ev_name); 358 hists__browser_title(browser->hists, title, sizeof(title), ev_name);
348 ui_browser__show_title(&browser->b, title); 359 ui_browser__show_title(&browser->b, title);
349 continue; 360 continue;
361 }
350 case 'D': { /* Debug */ 362 case 'D': { /* Debug */
351 static int seq; 363 static int seq;
352 struct hist_entry *h = rb_entry(browser->b.top, 364 struct hist_entry *h = rb_entry(browser->b.top,
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index f0a862539ba9..df46be93d902 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -36,6 +36,7 @@ struct perf_top {
36 int realtime_prio; 36 int realtime_prio;
37 int sym_pcnt_filter; 37 int sym_pcnt_filter;
38 const char *sym_filter; 38 const char *sym_filter;
39 float min_percent;
39}; 40};
40 41
41size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size); 42size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);