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>,
Namhyung Kim <namhyung@kernel.org>,
LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
David Ahern <dsahern@gmail.com>, Andi Kleen <andi@firstfloor.org>
Subject: [PATCH 08/10] perf tools: Allow hpp fields to be sort keys
Date: Tue, 4 Mar 2014 11:42:14 +0900 [thread overview]
Message-ID: <1393900936-22977-9-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1393900936-22977-1-git-send-email-namhyung@kernel.org>
Add overhead{,_sys,_us,_guest_sys,_guest_us}, sample and period sort
keys so that they can be selected with --sort/-s option.
$ perf report -s period,comm --stdio
...
# Overhead Period Command
# ........ ............ ...............
#
47.06% 152 swapper
13.93% 45 qemu-system-arm
12.38% 40 synergys
3.72% 12 firefox
2.48% 8 xchat
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/hist.c | 9 +++++++--
tools/perf/util/sort.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 59abcb4e40c7..8b7eb052a432 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -347,8 +347,13 @@ void perf_hpp__init(void)
int i;
for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
- INIT_LIST_HEAD(&perf_hpp__format[i].list);
- INIT_LIST_HEAD(&perf_hpp__format[i].sort_list);
+ struct perf_hpp_fmt *fmt = &perf_hpp__format[i];
+
+ INIT_LIST_HEAD(&fmt->list);
+
+ /* sort_list may be linked by setup_sorting() */
+ if (fmt->sort_list.next == NULL)
+ INIT_LIST_HEAD(&fmt->sort_list);
}
perf_hpp__column_enable(PERF_HPP__OVERHEAD);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index b2829f947053..916652af8304 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1028,6 +1028,26 @@ static struct sort_dimension memory_sort_dimensions[] = {
#undef DIM
+struct hpp_dimension {
+ const char *name;
+ struct perf_hpp_fmt *fmt;
+ int taken;
+};
+
+#define DIM(d, n) { .name = n, .fmt = &perf_hpp__format[d], }
+
+static struct hpp_dimension hpp_sort_dimensions[] = {
+ DIM(PERF_HPP__OVERHEAD, "overhead"),
+ DIM(PERF_HPP__OVERHEAD_SYS, "overhead_sys"),
+ DIM(PERF_HPP__OVERHEAD_US, "overhead_us"),
+ DIM(PERF_HPP__OVERHEAD_GUEST_SYS, "overhead_guest_sys"),
+ DIM(PERF_HPP__OVERHEAD_GUEST_US, "overhead_guest_us"),
+ DIM(PERF_HPP__SAMPLES, "sample"),
+ DIM(PERF_HPP__PERIOD, "period"),
+};
+
+#undef DIM
+
struct hpp_sort_entry {
struct perf_hpp_fmt hpp;
struct sort_entry *se;
@@ -1115,6 +1135,16 @@ static int __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx)
return 0;
}
+static int __hpp_dimension__add(struct hpp_dimension *hd)
+{
+ if (!hd->taken) {
+ hd->taken = 1;
+
+ perf_hpp__register_sort_field(hd->fmt);
+ }
+ return 0;
+}
+
int sort_dimension__add(const char *tok)
{
unsigned int i;
@@ -1144,6 +1174,15 @@ int sort_dimension__add(const char *tok)
return __sort_dimension__add(sd, i);
}
+ for (i = 0; i < ARRAY_SIZE(hpp_sort_dimensions); i++) {
+ struct hpp_dimension *hd = &hpp_sort_dimensions[i];
+
+ if (strncasecmp(tok, hd->name, strlen(tok)))
+ continue;
+
+ return __hpp_dimension__add(hd);
+ }
+
for (i = 0; i < ARRAY_SIZE(bstack_sort_dimensions); i++) {
struct sort_dimension *sd = &bstack_sort_dimensions[i];
--
1.7.11.7
next prev parent reply other threads:[~2014-03-04 2:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-04 2:42 [RFC 00/10] perf report: Add -F option for specifying output fields Namhyung Kim
2014-03-04 2:42 ` [PATCH 01/10] perf tools: Add ->cmp(), ->collapse() and ->sort() to perf_hpp_fmt Namhyung Kim
2014-03-04 2:42 ` [PATCH 02/10] perf tools: Convert sort entries to hpp formats Namhyung Kim
2014-03-04 2:42 ` [PATCH 03/10] perf tools: Use hpp formats to sort hist entries Namhyung Kim
2014-03-04 2:42 ` [PATCH 04/10] perf tools: Support event grouping in hpp ->sort() Namhyung Kim
2014-03-04 2:42 ` [PATCH 05/10] perf tools: Use hpp formats to sort final output Namhyung Kim
2014-03-04 2:42 ` [PATCH 06/10] perf tools: Consolidate output field handling to hpp format routines Namhyung Kim
2014-03-04 2:42 ` [PATCH 07/10] perf ui: Get rid of callback from __hpp__fmt() Namhyung Kim
2014-03-04 2:42 ` Namhyung Kim [this message]
2014-03-04 2:42 ` [PATCH 09/10] perf report: Add -F option to specify output fields Namhyung Kim
2014-03-04 2:42 ` [PATCH 10/10] perf tools: Add ->sort() member to struct sort_entry Namhyung Kim
2014-03-04 2:45 ` [RFC 00/10] perf report: Add -F option for specifying output fields Namhyung Kim
2014-03-04 7:19 ` Ingo Molnar
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=1393900936-22977-9-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
Powered by JetHome