mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Jiri Olsa <jolsa@redhat.com>, Ulrich Drepper <drepper@gmail.com>,
	Andi Kleen <andi@firstfloor.org>
Subject: [PATCH 01/12] perf tools: Add a couple of helper routines to handle groups
Date: Tue, 24 Jul 2012 18:01:22 +0900	[thread overview]
Message-ID: <1343120493-23059-2-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1343120493-23059-1-git-send-email-namhyung@kernel.org>

This is a preparation for upcoming event grouping feature.

Cc: Stephane Eranian <eranian@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/evsel.h        |   19 +++++++++++++++++++
 tools/perf/util/parse-events.c |    6 +++++-
 tools/perf/util/sort.h         |   10 ++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index a4a11f8dfcf5..efc9e5c42210 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -70,8 +70,27 @@ struct perf_evsel {
 	int			exclude_GH;
 	struct perf_evsel	*leader;
 	char			*group_name;
+	union {
+		int		nr_children;
+		int		group_idx;
+	};
 };
 
+static inline struct perf_evsel *hists_2_evsel(struct hists *hists)
+{
+	return container_of(hists, struct perf_evsel, hists);
+}
+
+static inline bool perf_evsel__is_group_leader(struct perf_evsel *evsel)
+{
+	return evsel->leader == NULL;
+}
+
+#define for_each_group_member(_evsel, _leader)				   \
+for ((_evsel) = list_entry((_leader)->node.next, struct perf_evsel, node); \
+     (_evsel) && (_evsel)->leader == (_leader);				   \
+     (_evsel) = list_entry((_evsel)->node.next, struct perf_evsel, node))
+
 struct cpu_map;
 struct thread_map;
 struct perf_evlist;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 9eaae05c088d..25dcf9043902 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -611,15 +611,19 @@ int parse_events_add_pmu(struct list_head **list, int *idx,
 
 struct perf_evsel *parse_events__group_leader(struct list_head *list)
 {
+	int idx = 0;
 	struct perf_evsel *evsel, *leader;
 
 	leader = list_entry(list->next, struct perf_evsel, node);
 	leader->leader = NULL;
 
 	list_for_each_entry(evsel, list, node)
-		if (evsel != leader)
+		if (evsel != leader) {
 			evsel->leader = leader;
+			evsel->group_idx = idx++;
+		}
 
+	leader->nr_children = idx;
 	return leader;
 }
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index e724b26acd51..9fdd5039339f 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -43,6 +43,15 @@ extern struct sort_entry sort_sym_from;
 extern struct sort_entry sort_sym_to;
 extern enum sort_type sort__first_dimension;
 
+struct he_stat {
+	u64			period;
+	u64			period_sys;
+	u64			period_us;
+	u64			period_guest_sys;
+	u64			period_guest_us;
+	u32			nr_events;
+};
+
 /**
  * struct hist_entry - histogram entry
  *
@@ -57,6 +66,7 @@ struct hist_entry {
 	u64			period_us;
 	u64			period_guest_sys;
 	u64			period_guest_us;
+	struct he_stat		*group_stats;
 	struct map_symbol	ms;
 	struct thread		*thread;
 	u64			ip;
-- 
1.7.10.4


  reply	other threads:[~2012-07-24  9:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-24  9:01 [RFC/PATCHSET 00/12] perf report: Add support to event group viewing (v1) Namhyung Kim
2012-07-24  9:01 ` Namhyung Kim [this message]
2012-07-24  9:01 ` [PATCH 02/12] perf hist: Convert to struct he_stat Namhyung Kim
2012-07-24  9:01 ` [PATCH 03/12] perf hist: Collapse group hist_entries to a leader Namhyung Kim
2012-07-24  9:01 ` [PATCH 04/12] perf hist: Maintain total periods of group members in the leader Namhyung Kim
2012-07-24  9:01 ` [PATCH 05/12] perf report: Make another loop for output resorting Namhyung Kim
2012-07-24  9:01 ` [PATCH 06/12] perf header: Reconstruct group relationship by parsing cmdline Namhyung Kim
2012-07-25 15:39   ` Jiri Olsa
2012-07-25 15:52     ` Namhyung Kim
2012-07-24  9:01 ` [PATCH 07/12] perf ui/hist: Add support to group viewing Namhyung Kim
2012-07-24  9:01 ` [PATCH 08/12] perf ui/browser: " Namhyung Kim
2012-07-24  9:01 ` [PATCH 09/12] perf ui/gtk: " Namhyung Kim
2012-07-24  9:01 ` [PATCH 10/12] perf report: Show leader events only when event group is enabled Namhyung Kim
2012-07-24  9:01 ` [PATCH 11/12] perf report: Show group description " Namhyung Kim
2012-07-24  9:01 ` [PATCH 12/12] perf report: Add --group option Namhyung Kim
2012-07-24  9:13 ` [RFC/PATCHSET 00/12] perf report: Add support to event group viewing (v1) Namhyung Kim
2012-07-24 21:17 ` Andi Kleen

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=1343120493-23059-2-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=drepper@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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

all inboxes | Powered by JetHome®