All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Stephane Eranian <eranian@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>
Subject: Re: [PATCH 01/12] perf tools: Keep group information
Date: Mon, 12 Nov 2012 14:08:33 -0300	[thread overview]
Message-ID: <20121112170833.GE18978@ghostprotocols.net> (raw)
In-Reply-To: <1352479414-2324-2-git-send-email-namhyung@kernel.org>

Em Sat, Nov 10, 2012 at 01:43:23AM +0900, Namhyung Kim escreveu:
> From: Namhyung Kim <namhyung.kim@lge.com>
> 
> Add a few of group-related field in struct perf_{evlist,evsel} so that
> the group information in a evlist can be known easily.  It only counts
> groups which have more than 1 members since leader-only groups are
> treated as non-group events.

We don't need to add a group_idx, we can get it using evsel->idx -
evsel->leader->idx, interdiff of this patch to what I think is
equivalent:

diff -u b/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
--- b/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -111,18 +111,16 @@
 void __perf_evlist__set_leader(struct list_head *list)
 {
 	struct perf_evsel *evsel, *leader;
-	int count = 0;
 
 	leader = list_entry(list->next, struct perf_evsel, node);
+	evsel = list_entry(list->prev, struct perf_evsel, node);
 	leader->leader = NULL;
+	leader->nr_members = evsel->idx - leader->idx + 1;
 
 	list_for_each_entry(evsel, list, node) {
-		if (evsel != leader) {
+		if (evsel != leader)
 			evsel->leader = leader;
-			evsel->group_idx = count++;
-		}
 	}
-	leader->nr_members = count;
 }
 
 void perf_evlist__set_leader(struct perf_evlist *evlist)
diff -u b/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
--- b/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -72,12 +72,9 @@
 	bool 			needs_swap;
 	/* parse modifier helper */
 	int			exclude_GH;
+	int			nr_members;
 	struct perf_evsel	*leader;
 	char			*group_name;
-	union {
-		int		nr_members;
-		int		group_idx;
-	};
 };
 
 struct cpu_map;
@@ -237,2 +234,11 @@
 }
+
+static inline int perf_evsel__group_idx(struct perf_evsel *evsel)
+{
+	if (perf_evsel__is_group_leader(evsel)
+		return 0;
+
+	return evsel->idx - evsel->leader->idx;
+}
+
 #endif /* __PERF_EVSEL_H */

  reply	other threads:[~2012-11-12 17:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 16:43 [PATCHSET 00/12] perf report: Add support for event group view (v5) Namhyung Kim
2012-11-09 16:43 ` [PATCH 01/12] perf tools: Keep group information Namhyung Kim
2012-11-12 17:08   ` Arnaldo Carvalho de Melo [this message]
2012-11-13  1:29     ` Namhyung Kim
2012-11-09 16:43 ` [PATCH 02/12] perf header: Add HEADER_GROUP_DESC feature Namhyung Kim
2012-11-12 17:45   ` Arnaldo Carvalho de Melo
2012-11-13  1:51     ` Namhyung Kim
2012-11-09 16:43 ` [PATCH 03/12] perf hists: Collapse group hist_entries to a leader Namhyung Kim
2012-11-09 16:43 ` [PATCH 04/12] perf hists: Maintain total periods of group members in the leader Namhyung Kim
2012-11-09 16:43 ` [PATCH 05/12] perf report: Make another loop for output resorting Namhyung Kim
2012-11-09 16:43 ` [PATCH 06/12] perf ui/hist: Add support for event group view Namhyung Kim
2012-11-09 16:43 ` [PATCH 07/12] perf ui/browser: " Namhyung Kim
2012-11-09 16:43 ` [PATCH 08/12] perf ui/gtk: " Namhyung Kim
2012-11-09 16:43 ` [PATCH 09/12] perf report: Bypass non-leader events when event group is enabled Namhyung Kim
2012-11-09 16:43 ` [PATCH 10/12] perf report: Show group description " Namhyung Kim
2012-11-09 16:43 ` [PATCH 11/12] perf report: Add --group option Namhyung Kim
2012-11-09 16:43 ` [PATCH 12/12] perf report: Add report.group config option Namhyung Kim
  -- strict thread matches above, loose matches on Subject: below --
2012-10-23  7:43 [PATCH 00/12] perf report: Add support for event group view (v4) Namhyung Kim
2012-10-23  7:43 ` [PATCH 01/12] perf tools: Keep group information 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=20121112170833.GE18978@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.