diff options
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 65aaa5bbf7ec..5b389ce4cd15 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -253,6 +253,9 @@ static struct hist_entry *perf_evsel__add_hist_entry(struct perf_evsel *evsel, | |||
253 | return NULL; | 253 | return NULL; |
254 | 254 | ||
255 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 255 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
256 | if (!he->filtered) | ||
257 | evsel->hists.stats.nr_non_filtered_samples++; | ||
258 | |||
256 | return he; | 259 | return he; |
257 | } | 260 | } |
258 | 261 | ||
@@ -694,8 +697,7 @@ static void perf_event__process_sample(struct perf_tool *tool, | |||
694 | if (event->header.misc & PERF_RECORD_MISC_EXACT_IP) | 697 | if (event->header.misc & PERF_RECORD_MISC_EXACT_IP) |
695 | top->exact_samples++; | 698 | top->exact_samples++; |
696 | 699 | ||
697 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0 || | 700 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) |
698 | al.filtered) | ||
699 | return; | 701 | return; |
700 | 702 | ||
701 | if (!top->kptr_restrict_warned && | 703 | if (!top->kptr_restrict_warned && |
@@ -1081,8 +1083,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1081 | OPT_INCR('v', "verbose", &verbose, | 1083 | OPT_INCR('v', "verbose", &verbose, |
1082 | "be more verbose (show counter open errors, etc)"), | 1084 | "be more verbose (show counter open errors, etc)"), |
1083 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 1085 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
1084 | "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight," | 1086 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." |
1085 | " abort, in_tx, transaction"), | 1087 | " Please refer the man page for the complete list."), |
1088 | OPT_STRING(0, "fields", &field_order, "key[,keys...]", | ||
1089 | "output field(s): overhead, period, sample plus all of sort keys"), | ||
1086 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, | 1090 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, |
1087 | "Show a column with the number of samples"), | 1091 | "Show a column with the number of samples"), |
1088 | OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts, | 1092 | OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts, |
@@ -1116,6 +1120,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1116 | OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), | 1120 | OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), |
1117 | OPT_CALLBACK(0, "percent-limit", &top, "percent", | 1121 | OPT_CALLBACK(0, "percent-limit", &top, "percent", |
1118 | "Don't show entries under that percent", parse_percent_limit), | 1122 | "Don't show entries under that percent", parse_percent_limit), |
1123 | OPT_CALLBACK(0, "percentage", NULL, "relative|absolute", | ||
1124 | "How to display percentage of filtered entries", parse_filter_percentage), | ||
1119 | OPT_END() | 1125 | OPT_END() |
1120 | }; | 1126 | }; |
1121 | const char * const top_usage[] = { | 1127 | const char * const top_usage[] = { |
@@ -1133,17 +1139,19 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1133 | if (argc) | 1139 | if (argc) |
1134 | usage_with_options(top_usage, options); | 1140 | usage_with_options(top_usage, options); |
1135 | 1141 | ||
1136 | if (sort_order == default_sort_order) | 1142 | sort__mode = SORT_MODE__TOP; |
1137 | sort_order = "dso,symbol"; | 1143 | /* display thread wants entries to be collapsed in a different tree */ |
1144 | sort__need_collapse = 1; | ||
1138 | 1145 | ||
1139 | if (setup_sorting() < 0) { | 1146 | if (setup_sorting() < 0) { |
1140 | parse_options_usage(top_usage, options, "s", 1); | 1147 | if (sort_order) |
1148 | parse_options_usage(top_usage, options, "s", 1); | ||
1149 | if (field_order) | ||
1150 | parse_options_usage(sort_order ? NULL : top_usage, | ||
1151 | options, "fields", 0); | ||
1141 | goto out_delete_evlist; | 1152 | goto out_delete_evlist; |
1142 | } | 1153 | } |
1143 | 1154 | ||
1144 | /* display thread wants entries to be collapsed in a different tree */ | ||
1145 | sort__need_collapse = 1; | ||
1146 | |||
1147 | if (top.use_stdio) | 1155 | if (top.use_stdio) |
1148 | use_browser = 0; | 1156 | use_browser = 0; |
1149 | else if (top.use_tui) | 1157 | else if (top.use_tui) |