aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-01-13 22:02:15 -0500
committerJiri Olsa <jolsa@redhat.com>2014-04-16 11:16:04 -0400
commit0b93da1756df4fe930ee0220a6addce263a6e0ab (patch)
tree2af9abbfd073bb6b84a5e03bcac41b8e1eabe22a
parent8810f6ced73556c1a63b6269a6cdad8d630aaaf0 (diff)
perf tools: Add hist.percentage config option
Add hist.percentage option for setting default value of the symbol_conf.filter_relative. It affects the output of various perf commands (like perf report, top and diff) only if filter(s) applied. An user can write .perfconfig file like below to show absolute percentage of filtered entries by default: $ cat ~/.perfconfig [hist] percentage = absolute And it can be changed through command line: $ perf report --percentage relative Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1397145720-8063-6-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@redhat.com>
-rw-r--r--tools/perf/builtin-diff.c2
-rw-r--r--tools/perf/util/config.c4
-rw-r--r--tools/perf/util/hist.c8
-rw-r--r--tools/perf/util/hist.h1
4 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index c903fe13c173..6ef80f22c1e2 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1134,6 +1134,8 @@ static int data_init(int argc, const char **argv)
1134 1134
1135int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) 1135int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
1136{ 1136{
1137 perf_config(perf_default_config, NULL);
1138
1137 sort_order = diff__default_sort_order; 1139 sort_order = diff__default_sort_order;
1138 argc = parse_options(argc, argv, options, diff_usage, 0); 1140 argc = parse_options(argc, argv, options, diff_usage, 0);
1139 1141
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 3e0fdd369ccb..24519e14ac56 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -11,6 +11,7 @@
11#include "util.h" 11#include "util.h"
12#include "cache.h" 12#include "cache.h"
13#include "exec_cmd.h" 13#include "exec_cmd.h"
14#include "util/hist.h" /* perf_hist_config */
14 15
15#define MAXNAME (256) 16#define MAXNAME (256)
16 17
@@ -355,6 +356,9 @@ int perf_default_config(const char *var, const char *value,
355 if (!prefixcmp(var, "core.")) 356 if (!prefixcmp(var, "core."))
356 return perf_default_core_config(var, value); 357 return perf_default_core_config(var, value);
357 358
359 if (!prefixcmp(var, "hist."))
360 return perf_hist_config(var, value);
361
358 /* Add other config variables here. */ 362 /* Add other config variables here. */
359 return 0; 363 return 0;
360} 364}
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 3c2dd233b98e..5a892477aa50 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -956,3 +956,11 @@ int parse_filter_percentage(const struct option *opt __maybe_unused,
956 956
957 return 0; 957 return 0;
958} 958}
959
960int perf_hist_config(const char *var, const char *value)
961{
962 if (!strcmp(var, "hist.percentage"))
963 return parse_filter_percentage(NULL, value, 0);
964
965 return 0;
966}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index a4ec336ae3fe..5a0343eb22e2 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -258,5 +258,6 @@ unsigned int hists__sort_list_width(struct hists *hists);
258struct option; 258struct option;
259int parse_filter_percentage(const struct option *opt __maybe_unused, 259int parse_filter_percentage(const struct option *opt __maybe_unused,
260 const char *arg, int unset __maybe_unused); 260 const char *arg, int unset __maybe_unused);
261int perf_hist_config(const char *var, const char *value);
261 262
262#endif /* __PERF_HIST_H */ 263#endif /* __PERF_HIST_H */