diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-05-13 22:09:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-05-28 09:24:01 -0400 |
commit | 064f19815c4e99e8b22bc3c5f4d7f4e0b96d226a (patch) | |
tree | 80630db03ec2432aa9a7a4975fa3a6f6fc3ac32b | |
parent | f3dd19817e5bbcae81e96571a3d42aa30a1581fb (diff) |
perf report: Add --percent-limit option
The --percent-limit option is for not showing small overhead entries in
the output. Maybe we want to set a certain default value like 0.1.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1368497347-9628-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/Documentation/perf-report.txt | 4 | ||||
-rw-r--r-- | tools/perf/builtin-diff.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 21 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 4 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 79 | ||||
-rw-r--r-- | tools/perf/ui/gtk/hists.c | 13 | ||||
-rw-r--r-- | tools/perf/ui/stdio/hist.c | 7 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 10 |
8 files changed, 115 insertions, 25 deletions
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 7d5f4f38aa52..66dab7410c1d 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt | |||
@@ -210,6 +210,10 @@ OPTIONS | |||
210 | Demangle symbol names to human readable form. It's enabled by default, | 210 | Demangle symbol names to human readable form. It's enabled by default, |
211 | disable with --no-demangle. | 211 | disable with --no-demangle. |
212 | 212 | ||
213 | --percent-limit:: | ||
214 | Do not show entries which have an overhead under that percent. | ||
215 | (Default: 0). | ||
216 | |||
213 | SEE ALSO | 217 | SEE ALSO |
214 | -------- | 218 | -------- |
215 | linkperf:perf-stat[1], linkperf:perf-annotate[1] | 219 | linkperf:perf-stat[1], linkperf:perf-annotate[1] |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index cabbea5f0bc2..a9d63c1c64c5 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -457,7 +457,7 @@ static void hists__process(struct hists *old, struct hists *new) | |||
457 | hists__output_resort(new); | 457 | hists__output_resort(new); |
458 | } | 458 | } |
459 | 459 | ||
460 | hists__fprintf(new, true, 0, 0, stdout); | 460 | hists__fprintf(new, true, 0, 0, 0, stdout); |
461 | } | 461 | } |
462 | 462 | ||
463 | static int __cmd_diff(void) | 463 | static int __cmd_diff(void) |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 0f0cf2472d9d..0a4979bdd4c4 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -52,6 +52,7 @@ struct perf_report { | |||
52 | symbol_filter_t annotate_init; | 52 | symbol_filter_t annotate_init; |
53 | const char *cpu_list; | 53 | const char *cpu_list; |
54 | const char *symbol_filter_str; | 54 | const char *symbol_filter_str; |
55 | float min_percent; | ||
55 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); | 56 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); |
56 | }; | 57 | }; |
57 | 58 | ||
@@ -456,7 +457,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist, | |||
456 | continue; | 457 | continue; |
457 | 458 | ||
458 | hists__fprintf_nr_sample_events(rep, hists, evname, stdout); | 459 | hists__fprintf_nr_sample_events(rep, hists, evname, stdout); |
459 | hists__fprintf(hists, true, 0, 0, stdout); | 460 | hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout); |
460 | fprintf(stdout, "\n\n"); | 461 | fprintf(stdout, "\n\n"); |
461 | } | 462 | } |
462 | 463 | ||
@@ -575,8 +576,8 @@ static int __cmd_report(struct perf_report *rep) | |||
575 | if (use_browser > 0) { | 576 | if (use_browser > 0) { |
576 | if (use_browser == 1) { | 577 | if (use_browser == 1) { |
577 | ret = perf_evlist__tui_browse_hists(session->evlist, | 578 | ret = perf_evlist__tui_browse_hists(session->evlist, |
578 | help, | 579 | help, NULL, |
579 | NULL, | 580 | rep->min_percent, |
580 | &session->header.env); | 581 | &session->header.env); |
581 | /* | 582 | /* |
582 | * Usually "ret" is the last pressed key, and we only | 583 | * Usually "ret" is the last pressed key, and we only |
@@ -587,7 +588,7 @@ static int __cmd_report(struct perf_report *rep) | |||
587 | 588 | ||
588 | } else if (use_browser == 2) { | 589 | } else if (use_browser == 2) { |
589 | perf_evlist__gtk_browse_hists(session->evlist, help, | 590 | perf_evlist__gtk_browse_hists(session->evlist, help, |
590 | NULL); | 591 | NULL, rep->min_percent); |
591 | } | 592 | } |
592 | } else | 593 | } else |
593 | perf_evlist__tty_browse_hists(session->evlist, rep, help); | 594 | perf_evlist__tty_browse_hists(session->evlist, rep, help); |
@@ -698,6 +699,16 @@ parse_branch_mode(const struct option *opt __maybe_unused, | |||
698 | return 0; | 699 | return 0; |
699 | } | 700 | } |
700 | 701 | ||
702 | static int | ||
703 | parse_percent_limit(const struct option *opt, const char *str, | ||
704 | int unset __maybe_unused) | ||
705 | { | ||
706 | struct perf_report *rep = opt->value; | ||
707 | |||
708 | rep->min_percent = strtof(str, NULL); | ||
709 | return 0; | ||
710 | } | ||
711 | |||
701 | int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | 712 | int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) |
702 | { | 713 | { |
703 | struct perf_session *session; | 714 | struct perf_session *session; |
@@ -807,6 +818,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
807 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, | 818 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, |
808 | "Disable symbol demangling"), | 819 | "Disable symbol demangling"), |
809 | OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"), | 820 | OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"), |
821 | OPT_CALLBACK(0, "percent-limit", &report, "percent", | ||
822 | "Don't show entries under that percent", parse_percent_limit), | ||
810 | OPT_END() | 823 | OPT_END() |
811 | }; | 824 | }; |
812 | 825 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index c2c973476479..19fe25f6e4f0 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -296,7 +296,7 @@ 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, stdout); | 299 | top->print_entries - printed, win_width, 0, stdout); |
300 | } | 300 | } |
301 | 301 | ||
302 | static void prompt_integer(int *target, const char *msg) | 302 | static void prompt_integer(int *target, const char *msg) |
@@ -580,7 +580,7 @@ static void *display_thread_tui(void *arg) | |||
580 | list_for_each_entry(pos, &top->evlist->entries, node) | 580 | list_for_each_entry(pos, &top->evlist->entries, node) |
581 | pos->hists.uid_filter_str = top->record_opts.target.uid_str; | 581 | pos->hists.uid_filter_str = top->record_opts.target.uid_str; |
582 | 582 | ||
583 | perf_evlist__tui_browse_hists(top->evlist, help, &hbt, | 583 | perf_evlist__tui_browse_hists(top->evlist, help, &hbt, 0, |
584 | &top->session->header.env); | 584 | &top->session->header.env); |
585 | 585 | ||
586 | done = 1; | 586 | done = 1; |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index a4268cab1921..9dfde61505cc 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -25,6 +25,8 @@ struct hist_browser { | |||
25 | struct map_symbol *selection; | 25 | struct map_symbol *selection; |
26 | int print_seq; | 26 | int print_seq; |
27 | bool show_dso; | 27 | bool show_dso; |
28 | float min_pcnt; | ||
29 | u64 nr_pcnt_entries; | ||
28 | }; | 30 | }; |
29 | 31 | ||
30 | extern void hist_browser__init_hpp(void); | 32 | extern void hist_browser__init_hpp(void); |
@@ -317,6 +319,8 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name, | |||
317 | 319 | ||
318 | browser->b.entries = &browser->hists->entries; | 320 | browser->b.entries = &browser->hists->entries; |
319 | browser->b.nr_entries = browser->hists->nr_entries; | 321 | browser->b.nr_entries = browser->hists->nr_entries; |
322 | if (browser->min_pcnt) | ||
323 | browser->b.nr_entries = browser->nr_pcnt_entries; | ||
320 | 324 | ||
321 | hist_browser__refresh_dimensions(browser); | 325 | hist_browser__refresh_dimensions(browser); |
322 | hists__browser_title(browser->hists, title, sizeof(title), ev_name); | 326 | hists__browser_title(browser->hists, title, sizeof(title), ev_name); |
@@ -795,10 +799,15 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser) | |||
795 | 799 | ||
796 | for (nd = browser->top; nd; nd = rb_next(nd)) { | 800 | for (nd = browser->top; nd; nd = rb_next(nd)) { |
797 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 801 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
802 | float percent = h->stat.period * 100.0 / | ||
803 | hb->hists->stats.total_period; | ||
798 | 804 | ||
799 | if (h->filtered) | 805 | if (h->filtered) |
800 | continue; | 806 | continue; |
801 | 807 | ||
808 | if (percent < hb->min_pcnt) | ||
809 | continue; | ||
810 | |||
802 | row += hist_browser__show_entry(hb, h, row); | 811 | row += hist_browser__show_entry(hb, h, row); |
803 | if (row == browser->height) | 812 | if (row == browser->height) |
804 | break; | 813 | break; |
@@ -807,10 +816,18 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser) | |||
807 | return row; | 816 | return row; |
808 | } | 817 | } |
809 | 818 | ||
810 | static struct rb_node *hists__filter_entries(struct rb_node *nd) | 819 | static struct rb_node *hists__filter_entries(struct rb_node *nd, |
820 | struct hists *hists, | ||
821 | float min_pcnt) | ||
811 | { | 822 | { |
812 | while (nd != NULL) { | 823 | while (nd != NULL) { |
813 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 824 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
825 | float percent = h->stat.period * 100.0 / | ||
826 | hists->stats.total_period; | ||
827 | |||
828 | if (percent < min_pcnt) | ||
829 | return NULL; | ||
830 | |||
814 | if (!h->filtered) | 831 | if (!h->filtered) |
815 | return nd; | 832 | return nd; |
816 | 833 | ||
@@ -820,11 +837,16 @@ static struct rb_node *hists__filter_entries(struct rb_node *nd) | |||
820 | return NULL; | 837 | return NULL; |
821 | } | 838 | } |
822 | 839 | ||
823 | static struct rb_node *hists__filter_prev_entries(struct rb_node *nd) | 840 | static struct rb_node *hists__filter_prev_entries(struct rb_node *nd, |
841 | struct hists *hists, | ||
842 | float min_pcnt) | ||
824 | { | 843 | { |
825 | while (nd != NULL) { | 844 | while (nd != NULL) { |
826 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 845 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
827 | if (!h->filtered) | 846 | float percent = h->stat.period * 100.0 / |
847 | hists->stats.total_period; | ||
848 | |||
849 | if (!h->filtered && percent >= min_pcnt) | ||
828 | return nd; | 850 | return nd; |
829 | 851 | ||
830 | nd = rb_prev(nd); | 852 | nd = rb_prev(nd); |
@@ -839,6 +861,9 @@ static void ui_browser__hists_seek(struct ui_browser *browser, | |||
839 | struct hist_entry *h; | 861 | struct hist_entry *h; |
840 | struct rb_node *nd; | 862 | struct rb_node *nd; |
841 | bool first = true; | 863 | bool first = true; |
864 | struct hist_browser *hb; | ||
865 | |||
866 | hb = container_of(browser, struct hist_browser, b); | ||
842 | 867 | ||
843 | if (browser->nr_entries == 0) | 868 | if (browser->nr_entries == 0) |
844 | return; | 869 | return; |
@@ -847,13 +872,15 @@ static void ui_browser__hists_seek(struct ui_browser *browser, | |||
847 | 872 | ||
848 | switch (whence) { | 873 | switch (whence) { |
849 | case SEEK_SET: | 874 | case SEEK_SET: |
850 | nd = hists__filter_entries(rb_first(browser->entries)); | 875 | nd = hists__filter_entries(rb_first(browser->entries), |
876 | hb->hists, hb->min_pcnt); | ||
851 | break; | 877 | break; |
852 | case SEEK_CUR: | 878 | case SEEK_CUR: |
853 | nd = browser->top; | 879 | nd = browser->top; |
854 | goto do_offset; | 880 | goto do_offset; |
855 | case SEEK_END: | 881 | case SEEK_END: |
856 | nd = hists__filter_prev_entries(rb_last(browser->entries)); | 882 | nd = hists__filter_prev_entries(rb_last(browser->entries), |
883 | hb->hists, hb->min_pcnt); | ||
857 | first = false; | 884 | first = false; |
858 | break; | 885 | break; |
859 | default: | 886 | default: |
@@ -896,7 +923,8 @@ do_offset: | |||
896 | break; | 923 | break; |
897 | } | 924 | } |
898 | } | 925 | } |
899 | nd = hists__filter_entries(rb_next(nd)); | 926 | nd = hists__filter_entries(rb_next(nd), hb->hists, |
927 | hb->min_pcnt); | ||
900 | if (nd == NULL) | 928 | if (nd == NULL) |
901 | break; | 929 | break; |
902 | --offset; | 930 | --offset; |
@@ -929,7 +957,8 @@ do_offset: | |||
929 | } | 957 | } |
930 | } | 958 | } |
931 | 959 | ||
932 | nd = hists__filter_prev_entries(rb_prev(nd)); | 960 | nd = hists__filter_prev_entries(rb_prev(nd), hb->hists, |
961 | hb->min_pcnt); | ||
933 | if (nd == NULL) | 962 | if (nd == NULL) |
934 | break; | 963 | break; |
935 | ++offset; | 964 | ++offset; |
@@ -1098,14 +1127,17 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser, | |||
1098 | 1127 | ||
1099 | static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp) | 1128 | static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp) |
1100 | { | 1129 | { |
1101 | struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries)); | 1130 | struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries), |
1131 | browser->hists, | ||
1132 | browser->min_pcnt); | ||
1102 | int printed = 0; | 1133 | int printed = 0; |
1103 | 1134 | ||
1104 | while (nd) { | 1135 | while (nd) { |
1105 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 1136 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
1106 | 1137 | ||
1107 | printed += hist_browser__fprintf_entry(browser, h, fp); | 1138 | printed += hist_browser__fprintf_entry(browser, h, fp); |
1108 | nd = hists__filter_entries(rb_next(nd)); | 1139 | nd = hists__filter_entries(rb_next(nd), browser->hists, |
1140 | browser->min_pcnt); | ||
1109 | } | 1141 | } |
1110 | 1142 | ||
1111 | return printed; | 1143 | return printed; |
@@ -1324,11 +1356,25 @@ close_file_and_continue: | |||
1324 | return ret; | 1356 | return ret; |
1325 | } | 1357 | } |
1326 | 1358 | ||
1359 | static void hist_browser__update_pcnt_entries(struct hist_browser *hb) | ||
1360 | { | ||
1361 | u64 nr_entries = 0; | ||
1362 | struct rb_node *nd = rb_first(&hb->hists->entries); | ||
1363 | |||
1364 | while (nd) { | ||
1365 | nr_entries++; | ||
1366 | nd = hists__filter_entries(rb_next(nd), hb->hists, | ||
1367 | hb->min_pcnt); | ||
1368 | } | ||
1369 | |||
1370 | hb->nr_pcnt_entries = nr_entries; | ||
1371 | } | ||
1327 | 1372 | ||
1328 | static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | 1373 | static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, |
1329 | const char *helpline, const char *ev_name, | 1374 | const char *helpline, const char *ev_name, |
1330 | bool left_exits, | 1375 | bool left_exits, |
1331 | struct hist_browser_timer *hbt, | 1376 | struct hist_browser_timer *hbt, |
1377 | float min_pcnt, | ||
1332 | struct perf_session_env *env) | 1378 | struct perf_session_env *env) |
1333 | { | 1379 | { |
1334 | struct hists *hists = &evsel->hists; | 1380 | struct hists *hists = &evsel->hists; |
@@ -1345,6 +1391,11 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
1345 | if (browser == NULL) | 1391 | if (browser == NULL) |
1346 | return -1; | 1392 | return -1; |
1347 | 1393 | ||
1394 | if (min_pcnt) { | ||
1395 | browser->min_pcnt = min_pcnt; | ||
1396 | hist_browser__update_pcnt_entries(browser); | ||
1397 | } | ||
1398 | |||
1348 | fstack = pstack__new(2); | 1399 | fstack = pstack__new(2); |
1349 | if (fstack == NULL) | 1400 | if (fstack == NULL) |
1350 | goto out; | 1401 | goto out; |
@@ -1684,6 +1735,7 @@ struct perf_evsel_menu { | |||
1684 | struct ui_browser b; | 1735 | struct ui_browser b; |
1685 | struct perf_evsel *selection; | 1736 | struct perf_evsel *selection; |
1686 | bool lost_events, lost_events_warned; | 1737 | bool lost_events, lost_events_warned; |
1738 | float min_pcnt; | ||
1687 | struct perf_session_env *env; | 1739 | struct perf_session_env *env; |
1688 | }; | 1740 | }; |
1689 | 1741 | ||
@@ -1777,6 +1829,7 @@ browse_hists: | |||
1777 | ev_name = perf_evsel__name(pos); | 1829 | ev_name = perf_evsel__name(pos); |
1778 | key = perf_evsel__hists_browse(pos, nr_events, help, | 1830 | key = perf_evsel__hists_browse(pos, nr_events, help, |
1779 | ev_name, true, hbt, | 1831 | ev_name, true, hbt, |
1832 | menu->min_pcnt, | ||
1780 | menu->env); | 1833 | menu->env); |
1781 | ui_browser__show_title(&menu->b, title); | 1834 | ui_browser__show_title(&menu->b, title); |
1782 | switch (key) { | 1835 | switch (key) { |
@@ -1838,6 +1891,7 @@ static bool filter_group_entries(struct ui_browser *self __maybe_unused, | |||
1838 | static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, | 1891 | static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, |
1839 | int nr_entries, const char *help, | 1892 | int nr_entries, const char *help, |
1840 | struct hist_browser_timer *hbt, | 1893 | struct hist_browser_timer *hbt, |
1894 | float min_pcnt, | ||
1841 | struct perf_session_env *env) | 1895 | struct perf_session_env *env) |
1842 | { | 1896 | { |
1843 | struct perf_evsel *pos; | 1897 | struct perf_evsel *pos; |
@@ -1851,6 +1905,7 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, | |||
1851 | .nr_entries = nr_entries, | 1905 | .nr_entries = nr_entries, |
1852 | .priv = evlist, | 1906 | .priv = evlist, |
1853 | }, | 1907 | }, |
1908 | .min_pcnt = min_pcnt, | ||
1854 | .env = env, | 1909 | .env = env, |
1855 | }; | 1910 | }; |
1856 | 1911 | ||
@@ -1869,6 +1924,7 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, | |||
1869 | 1924 | ||
1870 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | 1925 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, |
1871 | struct hist_browser_timer *hbt, | 1926 | struct hist_browser_timer *hbt, |
1927 | float min_pcnt, | ||
1872 | struct perf_session_env *env) | 1928 | struct perf_session_env *env) |
1873 | { | 1929 | { |
1874 | int nr_entries = evlist->nr_entries; | 1930 | int nr_entries = evlist->nr_entries; |
@@ -1880,7 +1936,8 @@ single_entry: | |||
1880 | const char *ev_name = perf_evsel__name(first); | 1936 | const char *ev_name = perf_evsel__name(first); |
1881 | 1937 | ||
1882 | return perf_evsel__hists_browse(first, nr_entries, help, | 1938 | return perf_evsel__hists_browse(first, nr_entries, help, |
1883 | ev_name, false, hbt, env); | 1939 | ev_name, false, hbt, min_pcnt, |
1940 | env); | ||
1884 | } | 1941 | } |
1885 | 1942 | ||
1886 | if (symbol_conf.event_group) { | 1943 | if (symbol_conf.event_group) { |
@@ -1896,5 +1953,5 @@ single_entry: | |||
1896 | } | 1953 | } |
1897 | 1954 | ||
1898 | return __perf_evlist__tui_browse_hists(evlist, nr_entries, help, | 1955 | return __perf_evlist__tui_browse_hists(evlist, nr_entries, help, |
1899 | hbt, env); | 1956 | hbt, min_pcnt, env); |
1900 | } | 1957 | } |
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index 6f259b3d14e2..9708dd5fb8f3 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c | |||
@@ -124,7 +124,8 @@ void perf_gtk__init_hpp(void) | |||
124 | perf_gtk__hpp_color_overhead_guest_us; | 124 | perf_gtk__hpp_color_overhead_guest_us; |
125 | } | 125 | } |
126 | 126 | ||
127 | static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) | 127 | static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists, |
128 | float min_pcnt) | ||
128 | { | 129 | { |
129 | struct perf_hpp_fmt *fmt; | 130 | struct perf_hpp_fmt *fmt; |
130 | GType col_types[MAX_COLUMNS]; | 131 | GType col_types[MAX_COLUMNS]; |
@@ -189,10 +190,15 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) | |||
189 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { | 190 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { |
190 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 191 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
191 | GtkTreeIter iter; | 192 | GtkTreeIter iter; |
193 | float percent = h->stat.period * 100.0 / | ||
194 | hists->stats.total_period; | ||
192 | 195 | ||
193 | if (h->filtered) | 196 | if (h->filtered) |
194 | continue; | 197 | continue; |
195 | 198 | ||
199 | if (percent < min_pcnt) | ||
200 | continue; | ||
201 | |||
196 | gtk_list_store_append(store, &iter); | 202 | gtk_list_store_append(store, &iter); |
197 | 203 | ||
198 | col_idx = 0; | 204 | col_idx = 0; |
@@ -222,7 +228,8 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) | |||
222 | 228 | ||
223 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | 229 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, |
224 | const char *help, | 230 | const char *help, |
225 | struct hist_browser_timer *hbt __maybe_unused) | 231 | struct hist_browser_timer *hbt __maybe_unused, |
232 | float min_pcnt) | ||
226 | { | 233 | { |
227 | struct perf_evsel *pos; | 234 | struct perf_evsel *pos; |
228 | GtkWidget *vbox; | 235 | GtkWidget *vbox; |
@@ -286,7 +293,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | |||
286 | GTK_POLICY_AUTOMATIC, | 293 | GTK_POLICY_AUTOMATIC, |
287 | GTK_POLICY_AUTOMATIC); | 294 | GTK_POLICY_AUTOMATIC); |
288 | 295 | ||
289 | perf_gtk__show_hists(scrolled_window, hists); | 296 | perf_gtk__show_hists(scrolled_window, hists, min_pcnt); |
290 | 297 | ||
291 | tab_label = gtk_label_new(evname); | 298 | tab_label = gtk_label_new(evname); |
292 | 299 | ||
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index ff1f60cf442e..ae7a75432249 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -334,7 +334,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, | |||
334 | } | 334 | } |
335 | 335 | ||
336 | size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | 336 | size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, |
337 | int max_cols, FILE *fp) | 337 | int max_cols, float min_pcnt, FILE *fp) |
338 | { | 338 | { |
339 | struct perf_hpp_fmt *fmt; | 339 | struct perf_hpp_fmt *fmt; |
340 | struct sort_entry *se; | 340 | struct sort_entry *se; |
@@ -440,10 +440,15 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
440 | print_entries: | 440 | print_entries: |
441 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { | 441 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { |
442 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 442 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
443 | float percent = h->stat.period * 100.0 / | ||
444 | hists->stats.total_period; | ||
443 | 445 | ||
444 | if (h->filtered) | 446 | if (h->filtered) |
445 | continue; | 447 | continue; |
446 | 448 | ||
449 | if (percent < min_pcnt) | ||
450 | continue; | ||
451 | |||
447 | ret += hist_entry__fprintf(h, max_cols, hists, fp); | 452 | ret += hist_entry__fprintf(h, max_cols, hists, fp); |
448 | 453 | ||
449 | if (max_rows && ++nr_rows >= max_rows) | 454 | if (max_rows && ++nr_rows >= max_rows) |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index bd81d799a1bf..2d3790fd99bb 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -115,7 +115,7 @@ void events_stats__inc(struct events_stats *stats, u32 type); | |||
115 | size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); | 115 | size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); |
116 | 116 | ||
117 | size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, | 117 | size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, |
118 | int max_cols, FILE *fp); | 118 | int max_cols, float min_pcnt, FILE *fp); |
119 | 119 | ||
120 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); | 120 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); |
121 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); | 121 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); |
@@ -195,6 +195,7 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, | |||
195 | 195 | ||
196 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | 196 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, |
197 | struct hist_browser_timer *hbt, | 197 | struct hist_browser_timer *hbt, |
198 | float min_pcnt, | ||
198 | struct perf_session_env *env); | 199 | struct perf_session_env *env); |
199 | int script_browse(const char *script_opt); | 200 | int script_browse(const char *script_opt); |
200 | #else | 201 | #else |
@@ -202,6 +203,7 @@ static inline | |||
202 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, | 203 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, |
203 | const char *help __maybe_unused, | 204 | const char *help __maybe_unused, |
204 | struct hist_browser_timer *hbt __maybe_unused, | 205 | struct hist_browser_timer *hbt __maybe_unused, |
206 | float min_pcnt __maybe_unused, | ||
205 | struct perf_session_env *env __maybe_unused) | 207 | struct perf_session_env *env __maybe_unused) |
206 | { | 208 | { |
207 | return 0; | 209 | return 0; |
@@ -229,12 +231,14 @@ static inline int script_browse(const char *script_opt __maybe_unused) | |||
229 | 231 | ||
230 | #ifdef GTK2_SUPPORT | 232 | #ifdef GTK2_SUPPORT |
231 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, | 233 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, |
232 | struct hist_browser_timer *hbt __maybe_unused); | 234 | struct hist_browser_timer *hbt __maybe_unused, |
235 | float min_pcnt); | ||
233 | #else | 236 | #else |
234 | static inline | 237 | static inline |
235 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, | 238 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, |
236 | const char *help __maybe_unused, | 239 | const char *help __maybe_unused, |
237 | struct hist_browser_timer *hbt __maybe_unused) | 240 | struct hist_browser_timer *hbt __maybe_unused, |
241 | float min_pcnt __maybe_unused) | ||
238 | { | 242 | { |
239 | return 0; | 243 | return 0; |
240 | } | 244 | } |