perf top: Add --percentage option
The --percentage option is for controlling overhead percentage displayed. It can only receive either of "relative" or "absolute". Move the parser callback function into a common location since it's used by multiple commands now. For more information, please see previous commit same thing done to "perf report". Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1397145720-8063-4-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@redhat.com>
This commit is contained in:
parent
f214833054
commit
33db4568e1
@ -123,13 +123,16 @@ Default is to monitor all CPUS.
|
|||||||
Show a column with the sum of periods.
|
Show a column with the sum of periods.
|
||||||
|
|
||||||
--dsos::
|
--dsos::
|
||||||
Only consider symbols in these dsos.
|
Only consider symbols in these dsos. This option will affect the
|
||||||
|
percentage of the overhead column. See --percentage for more info.
|
||||||
|
|
||||||
--comms::
|
--comms::
|
||||||
Only consider symbols in these comms.
|
Only consider symbols in these comms. This option will affect the
|
||||||
|
percentage of the overhead column. See --percentage for more info.
|
||||||
|
|
||||||
--symbols::
|
--symbols::
|
||||||
Only consider these symbols.
|
Only consider these symbols. This option will affect the
|
||||||
|
percentage of the overhead column. See --percentage for more info.
|
||||||
|
|
||||||
-M::
|
-M::
|
||||||
--disassembler-style=:: Set disassembler style for objdump.
|
--disassembler-style=:: Set disassembler style for objdump.
|
||||||
@ -165,6 +168,15 @@ Default is to monitor all CPUS.
|
|||||||
Do not show entries which have an overhead under that percent.
|
Do not show entries which have an overhead under that percent.
|
||||||
(Default: 0).
|
(Default: 0).
|
||||||
|
|
||||||
|
--percentage::
|
||||||
|
Determine how to display the overhead percentage of filtered entries.
|
||||||
|
Filters can be applied by --comms, --dsos and/or --symbols options and
|
||||||
|
Zoom operations on the TUI (thread, dso, etc).
|
||||||
|
|
||||||
|
"relative" means it's relative to filtered entries only so that the
|
||||||
|
sum of shown entries will be always 100%. "absolute" means it retains
|
||||||
|
the original value before and after the filter is applied.
|
||||||
|
|
||||||
INTERACTIVE PROMPTING KEYS
|
INTERACTIVE PROMPTING KEYS
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
@ -717,20 +717,6 @@ parse_percent_limit(const struct option *opt, const char *str,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
parse_percentage(const struct option *opt __maybe_unused, const char *str,
|
|
||||||
int unset __maybe_unused)
|
|
||||||
{
|
|
||||||
if (!strcmp(str, "relative"))
|
|
||||||
symbol_conf.filter_relative = true;
|
|
||||||
else if (!strcmp(str, "absolute"))
|
|
||||||
symbol_conf.filter_relative = false;
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
|
int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
|
||||||
{
|
{
|
||||||
struct perf_session *session;
|
struct perf_session *session;
|
||||||
@ -854,7 +840,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
|
|||||||
OPT_CALLBACK(0, "percent-limit", &report, "percent",
|
OPT_CALLBACK(0, "percent-limit", &report, "percent",
|
||||||
"Don't show entries under that percent", parse_percent_limit),
|
"Don't show entries under that percent", parse_percent_limit),
|
||||||
OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
|
OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
|
||||||
"how to display percentage of filtered entries", parse_percentage),
|
"how to display percentage of filtered entries", parse_filter_percentage),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
struct perf_data_file file = {
|
struct perf_data_file file = {
|
||||||
|
@ -697,8 +697,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
|
|||||||
if (event->header.misc & PERF_RECORD_MISC_EXACT_IP)
|
if (event->header.misc & PERF_RECORD_MISC_EXACT_IP)
|
||||||
top->exact_samples++;
|
top->exact_samples++;
|
||||||
|
|
||||||
if (perf_event__preprocess_sample(event, machine, &al, sample) < 0 ||
|
if (perf_event__preprocess_sample(event, machine, &al, sample) < 0)
|
||||||
al.filtered)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!top->kptr_restrict_warned &&
|
if (!top->kptr_restrict_warned &&
|
||||||
@ -1119,6 +1118,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
|
|||||||
OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
|
OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
|
||||||
OPT_CALLBACK(0, "percent-limit", &top, "percent",
|
OPT_CALLBACK(0, "percent-limit", &top, "percent",
|
||||||
"Don't show entries under that percent", parse_percent_limit),
|
"Don't show entries under that percent", parse_percent_limit),
|
||||||
|
OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
|
||||||
|
"How to display percentage of filtered entries", parse_filter_percentage),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
const char * const top_usage[] = {
|
const char * const top_usage[] = {
|
||||||
|
@ -943,3 +943,16 @@ u64 hists__total_period(struct hists *hists)
|
|||||||
return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period :
|
return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period :
|
||||||
hists->stats.total_period;
|
hists->stats.total_period;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int parse_filter_percentage(const struct option *opt __maybe_unused,
|
||||||
|
const char *arg, int unset __maybe_unused)
|
||||||
|
{
|
||||||
|
if (!strcmp(arg, "relative"))
|
||||||
|
symbol_conf.filter_relative = true;
|
||||||
|
else if (!strcmp(arg, "absolute"))
|
||||||
|
symbol_conf.filter_relative = false;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -254,4 +254,9 @@ static inline int script_browse(const char *script_opt __maybe_unused)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int hists__sort_list_width(struct hists *hists);
|
unsigned int hists__sort_list_width(struct hists *hists);
|
||||||
|
|
||||||
|
struct option;
|
||||||
|
int parse_filter_percentage(const struct option *opt __maybe_unused,
|
||||||
|
const char *arg, int unset __maybe_unused);
|
||||||
|
|
||||||
#endif /* __PERF_HIST_H */
|
#endif /* __PERF_HIST_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user