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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1343120493-23059-2-git-send-email-namhyung@kernel.org>
Date:	Tue, 24 Jul 2012 18:01:22 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Stephane Eranian <eranian@...gle.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Ulrich Drepper <drepper@...il.com>,
	Andi Kleen <andi@...stfloor.org>
Subject: [PATCH 01/12] perf tools: Add a couple of helper routines to handle groups

This is a preparation for upcoming event grouping feature.

Cc: Stephane Eranian <eranian@...gle.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.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

--
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