From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
Namhyung Kim <namhyung.kim@lge.com>,
LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
David Ahern <dsahern@gmail.com>, Andi Kleen <andi@firstfloor.org>
Subject: [PATCH 6/8] perf tools: Add hist.percentage config option
Date: Mon, 10 Feb 2014 11:47:23 +0900 [thread overview]
Message-ID: <1392000446-14744-7-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1392000446-14744-1-git-send-email-namhyung@kernel.org>
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>
---
tools/perf/builtin-diff.c | 2 ++
tools/perf/util/config.c | 4 ++++
tools/perf/util/hist.c | 14 ++++++++++++++
tools/perf/util/hist.h | 3 +++
4 files changed, 23 insertions(+)
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 2c7406d9eb5d..839c8c0b1060 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1153,6 +1153,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);
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 @@
#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;
}
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 3d9cdf97cfce..84adde197c05 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -934,3 +934,17 @@ int hists__link(struct hists *leader, struct hists *other)
return 0;
}
+
+int perf_hist_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "hist.percentage")) {
+ if (!strcmp(value, "relative"))
+ symbol_conf.filter_relative = true;
+ else if (!strcmp(value, "absolute"))
+ symbol_conf.filter_relative = false;
+ else
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 2f5686f4031b..cb8250d078b1 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -237,4 +237,7 @@ static inline int script_browse(const char *script_opt __maybe_unused)
#endif
unsigned int hists__sort_list_width(struct hists *hists);
+
+int perf_hist_config(const char *var, const char *value);
+
#endif /* __PERF_HIST_H */
--
1.7.11.7
next prev parent reply other threads:[~2014-02-10 2:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-10 2:47 [PATCHSET 0/8] perf tools: Update on filtered entries' percentage output (v4) Namhyung Kim
2014-02-10 2:47 ` [PATCH 1/8] perf tools: Count periods of filtered entries separately Namhyung Kim
2014-02-10 2:47 ` [PATCH 2/8] perf hists: Add support for showing relative percentage Namhyung Kim
2014-02-10 2:47 ` [PATCH 3/8] perf report: Add --percentage option Namhyung Kim
2014-02-20 10:39 ` Jiri Olsa
2014-02-24 6:37 ` Namhyung Kim
2014-02-10 2:47 ` [PATCH 4/8] perf top: " Namhyung Kim
2014-02-20 10:44 ` Jiri Olsa
2014-02-24 6:37 ` Namhyung Kim
2014-02-10 2:47 ` [PATCH 5/8] perf diff: " Namhyung Kim
2014-02-20 10:47 ` Jiri Olsa
2014-02-20 10:49 ` Jiri Olsa
2014-02-10 2:47 ` Namhyung Kim [this message]
2014-02-20 11:01 ` [PATCH 6/8] perf tools: Add hist.percentage config option Jiri Olsa
2014-02-24 6:41 ` Namhyung Kim
2014-02-10 2:47 ` [PATCH 7/7] perf tools: Show absolute percentage by default Namhyung Kim
2014-02-10 3:00 ` Namhyung Kim
2014-02-10 2:47 ` [PATCH 7/8] perf ui/tui: Add 'F' hotkey to toggle percentage output Namhyung Kim
2014-02-20 10:54 ` Jiri Olsa
2014-02-24 7:49 ` Namhyung Kim
2014-02-10 2:47 ` [PATCH 8/8] perf tools: Show absolute percentage by default Namhyung Kim
2014-02-20 1:00 ` [PATCHSET 0/8] perf tools: Update on filtered entries' percentage output (v4) Namhyung Kim
-- strict thread matches above, loose matches on Subject: below --
2014-02-24 8:09 [PATCHSET 0/8] perf tools: Update on filtered entries' percentage output (v5) Namhyung Kim
2014-02-24 8:09 ` [PATCH 6/8] perf tools: Add hist.percentage config option Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392000446-14744-7-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).