Commit 0b93da17 authored by Namhyung Kim's avatar Namhyung Kim Committed by Jiri Olsa

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: default avatarNamhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1397145720-8063-6-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarJiri Olsa <jolsa@redhat.com>
parent 8810f6ce
...@@ -1134,6 +1134,8 @@ static int data_init(int argc, const char **argv) ...@@ -1134,6 +1134,8 @@ static int data_init(int argc, const char **argv)
int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
{ {
perf_config(perf_default_config, NULL);
sort_order = diff__default_sort_order; sort_order = diff__default_sort_order;
argc = parse_options(argc, argv, options, diff_usage, 0); argc = parse_options(argc, argv, options, diff_usage, 0);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "util.h" #include "util.h"
#include "cache.h" #include "cache.h"
#include "exec_cmd.h" #include "exec_cmd.h"
#include "util/hist.h" /* perf_hist_config */
#define MAXNAME (256) #define MAXNAME (256)
...@@ -355,6 +356,9 @@ int perf_default_config(const char *var, const char *value, ...@@ -355,6 +356,9 @@ int perf_default_config(const char *var, const char *value,
if (!prefixcmp(var, "core.")) if (!prefixcmp(var, "core."))
return perf_default_core_config(var, value); return perf_default_core_config(var, value);
if (!prefixcmp(var, "hist."))
return perf_hist_config(var, value);
/* Add other config variables here. */ /* Add other config variables here. */
return 0; return 0;
} }
......
...@@ -956,3 +956,11 @@ int parse_filter_percentage(const struct option *opt __maybe_unused, ...@@ -956,3 +956,11 @@ int parse_filter_percentage(const struct option *opt __maybe_unused,
return 0; return 0;
} }
int perf_hist_config(const char *var, const char *value)
{
if (!strcmp(var, "hist.percentage"))
return parse_filter_percentage(NULL, value, 0);
return 0;
}
...@@ -258,5 +258,6 @@ unsigned int hists__sort_list_width(struct hists *hists); ...@@ -258,5 +258,6 @@ unsigned int hists__sort_list_width(struct hists *hists);
struct option; struct option;
int parse_filter_percentage(const struct option *opt __maybe_unused, int parse_filter_percentage(const struct option *opt __maybe_unused,
const char *arg, int unset __maybe_unused); const char *arg, int unset __maybe_unused);
int perf_hist_config(const char *var, const char *value);
#endif /* __PERF_HIST_H */ #endif /* __PERF_HIST_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment