]> git.karo-electronics.de Git - linux-beck.git/commitdiff
perf tools: Add hist.percentage config option
authorNamhyung Kim <namhyung@kernel.org>
Tue, 14 Jan 2014 03:02:15 +0000 (12:02 +0900)
committerJiri Olsa <jolsa@redhat.com>
Wed, 16 Apr 2014 15:16:04 +0000 (17:16 +0200)
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>
tools/perf/builtin-diff.c
tools/perf/util/config.c
tools/perf/util/hist.c
tools/perf/util/hist.h

index c903fe13c173282b58aadfefb202c15e2640daad..6ef80f22c1e2fefe5cc2d6c68864b72b1a730a30 100644 (file)
@@ -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)
 {
+       perf_config(perf_default_config, NULL);
+
        sort_order = diff__default_sort_order;
        argc = parse_options(argc, argv, options, diff_usage, 0);
 
index 3e0fdd369ccb12223d63359ecf4e32ca95133157..24519e14ac569cf62a8cadce29c9073d5ac9ae64 100644 (file)
@@ -11,6 +11,7 @@
 #include "util.h"
 #include "cache.h"
 #include "exec_cmd.h"
+#include "util/hist.h"  /* perf_hist_config */
 
 #define MAXNAME (256)
 
@@ -355,6 +356,9 @@ int perf_default_config(const char *var, const char *value,
        if (!prefixcmp(var, "core."))
                return perf_default_core_config(var, value);
 
+       if (!prefixcmp(var, "hist."))
+               return perf_hist_config(var, value);
+
        /* Add other config variables here. */
        return 0;
 }
index 3c2dd233b98e1019b2039845e34ae90794418bb3..5a892477aa50b345d83c02c2c53faf4dce660248 100644 (file)
@@ -956,3 +956,11 @@ int parse_filter_percentage(const struct option *opt __maybe_unused,
 
        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;
+}
index a4ec336ae3fe28c88852c8329d93147cd99ded06..5a0343eb22e2e2e8f5487fc86a5d216a8bc14cff 100644 (file)
@@ -258,5 +258,6 @@ 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);
+int perf_hist_config(const char *var, const char *value);
 
 #endif /* __PERF_HIST_H */