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>
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 7ec351b..af8cb7a 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -717,20 +717,6 @@
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)
{
struct perf_session *session;
@@ -854,7 +840,7 @@
OPT_CALLBACK(0, "percent-limit", &report, "percent",
"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_percentage),
+ "how to display percentage of filtered entries", parse_filter_percentage),
OPT_END()
};
struct perf_data_file file = {