aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-02-06 22:06:07 -0500
committerJiri Olsa <jolsa@redhat.com>2014-04-16 11:16:03 -0400
commit33db4568e1f41efe6d0e4695483f968fc1135bf3 (patch)
tree864186165ad27a133c773d36dd83b20cf5a19abc /tools/perf/util/hist.c
parentf2148330544a697481219b5bc34261f6dd049bfb (diff)
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>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c13
1 files changed, 13 insertions, 0 deletions
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
947int 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}