diff options
-rw-r--r-- | tools/perf/Documentation/perf-top.txt | 18 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 16 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 5 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 13 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 5 |
5 files changed, 37 insertions, 20 deletions
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index 976b00c6cdb1..64ed79c43639 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -123,13 +123,16 @@ Default is to monitor all CPUS. | |||
123 | Show a column with the sum of periods. | 123 | Show a column with the sum of periods. |
124 | 124 | ||
125 | --dsos:: | 125 | --dsos:: |
126 | Only consider symbols in these dsos. | 126 | Only consider symbols in these dsos. This option will affect the |
127 | percentage of the overhead column. See --percentage for more info. | ||
127 | 128 | ||
128 | --comms:: | 129 | --comms:: |
129 | Only consider symbols in these comms. | 130 | Only consider symbols in these comms. This option will affect the |
131 | percentage of the overhead column. See --percentage for more info. | ||
130 | 132 | ||
131 | --symbols:: | 133 | --symbols:: |
132 | Only consider these symbols. | 134 | Only consider these symbols. This option will affect the |
135 | percentage of the overhead column. See --percentage for more info. | ||
133 | 136 | ||
134 | -M:: | 137 | -M:: |
135 | --disassembler-style=:: Set disassembler style for objdump. | 138 | --disassembler-style=:: Set disassembler style for objdump. |
@@ -165,6 +168,15 @@ Default is to monitor all CPUS. | |||
165 | Do not show entries which have an overhead under that percent. | 168 | Do not show entries which have an overhead under that percent. |
166 | (Default: 0). | 169 | (Default: 0). |
167 | 170 | ||
171 | --percentage:: | ||
172 | Determine how to display the overhead percentage of filtered entries. | ||
173 | Filters can be applied by --comms, --dsos and/or --symbols options and | ||
174 | Zoom operations on the TUI (thread, dso, etc). | ||
175 | |||
176 | "relative" means it's relative to filtered entries only so that the | ||
177 | sum of shown entries will be always 100%. "absolute" means it retains | ||
178 | the original value before and after the filter is applied. | ||
179 | |||
168 | INTERACTIVE PROMPTING KEYS | 180 | INTERACTIVE PROMPTING KEYS |
169 | -------------------------- | 181 | -------------------------- |
170 | 182 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 7ec351bda833..af8cb7a2c9b6 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -717,20 +717,6 @@ parse_percent_limit(const struct option *opt, const char *str, | |||
717 | return 0; | 717 | return 0; |
718 | } | 718 | } |
719 | 719 | ||
720 | static int | ||
721 | parse_percentage(const struct option *opt __maybe_unused, const char *str, | ||
722 | int unset __maybe_unused) | ||
723 | { | ||
724 | if (!strcmp(str, "relative")) | ||
725 | symbol_conf.filter_relative = true; | ||
726 | else if (!strcmp(str, "absolute")) | ||
727 | symbol_conf.filter_relative = false; | ||
728 | else | ||
729 | return -1; | ||
730 | |||
731 | return 0; | ||
732 | } | ||
733 | |||
734 | int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | 720 | int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) |
735 | { | 721 | { |
736 | struct perf_session *session; | 722 | struct perf_session *session; |
@@ -854,7 +840,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
854 | OPT_CALLBACK(0, "percent-limit", &report, "percent", | 840 | OPT_CALLBACK(0, "percent-limit", &report, "percent", |
855 | "Don't show entries under that percent", parse_percent_limit), | 841 | "Don't show entries under that percent", parse_percent_limit), |
856 | OPT_CALLBACK(0, "percentage", NULL, "relative|absolute", | 842 | OPT_CALLBACK(0, "percentage", NULL, "relative|absolute", |
857 | "how to display percentage of filtered entries", parse_percentage), | 843 | "how to display percentage of filtered entries", parse_filter_percentage), |
858 | OPT_END() | 844 | OPT_END() |
859 | }; | 845 | }; |
860 | struct perf_data_file file = { | 846 | struct perf_data_file file = { |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 25269014164a..37d30460bada 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -697,8 +697,7 @@ static void perf_event__process_sample(struct perf_tool *tool, | |||
697 | if (event->header.misc & PERF_RECORD_MISC_EXACT_IP) | 697 | if (event->header.misc & PERF_RECORD_MISC_EXACT_IP) |
698 | top->exact_samples++; | 698 | top->exact_samples++; |
699 | 699 | ||
700 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0 || | 700 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) |
701 | al.filtered) | ||
702 | return; | 701 | return; |
703 | 702 | ||
704 | if (!top->kptr_restrict_warned && | 703 | if (!top->kptr_restrict_warned && |
@@ -1119,6 +1118,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1119 | OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), | 1118 | OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), |
1120 | OPT_CALLBACK(0, "percent-limit", &top, "percent", | 1119 | OPT_CALLBACK(0, "percent-limit", &top, "percent", |
1121 | "Don't show entries under that percent", parse_percent_limit), | 1120 | "Don't show entries under that percent", parse_percent_limit), |
1121 | OPT_CALLBACK(0, "percentage", NULL, "relative|absolute", | ||
1122 | "How to display percentage of filtered entries", parse_filter_percentage), | ||
1122 | OPT_END() | 1123 | OPT_END() |
1123 | }; | 1124 | }; |
1124 | const char * const top_usage[] = { | 1125 | const char * const top_usage[] = { |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 3ebd89a28257..3c2dd233b98e 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -943,3 +943,16 @@ u64 hists__total_period(struct hists *hists) | |||
943 | return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period : | 943 | return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period : |
944 | hists->stats.total_period; | 944 | hists->stats.total_period; |
945 | } | 945 | } |
946 | |||
947 | int parse_filter_percentage(const struct option *opt __maybe_unused, | ||
948 | const char *arg, int unset __maybe_unused) | ||
949 | { | ||
950 | if (!strcmp(arg, "relative")) | ||
951 | symbol_conf.filter_relative = true; | ||
952 | else if (!strcmp(arg, "absolute")) | ||
953 | symbol_conf.filter_relative = false; | ||
954 | else | ||
955 | return -1; | ||
956 | |||
957 | return 0; | ||
958 | } | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 3191496bd3b7..a4ec336ae3fe 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -254,4 +254,9 @@ static inline int script_browse(const char *script_opt __maybe_unused) | |||
254 | #endif | 254 | #endif |
255 | 255 | ||
256 | unsigned int hists__sort_list_width(struct hists *hists); | 256 | unsigned int hists__sort_list_width(struct hists *hists); |
257 | |||
258 | struct option; | ||
259 | int parse_filter_percentage(const struct option *opt __maybe_unused, | ||
260 | const char *arg, int unset __maybe_unused); | ||
261 | |||
257 | #endif /* __PERF_HIST_H */ | 262 | #endif /* __PERF_HIST_H */ |