lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121112170833.GE18978@ghostprotocols.net>
Date:	Mon, 12 Nov 2012 14:08:33 -0300
From:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Olsa <jolsa@...hat.com>,
	Stephane Eranian <eranian@...gle.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>
Subject: Re: [PATCH 01/12] perf tools: Keep group information

Em Sat, Nov 10, 2012 at 01:43:23AM +0900, Namhyung Kim escreveu:
> From: Namhyung Kim <namhyung.kim@....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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ