aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-03-05 19:40:06 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-03-06 11:13:40 -0500
commite248de331a452f8771eda6ed4bb30d92c82df28b (patch)
tree7ef04743a7bf7a1da354a3b82536ef32504823d9 /tools/perf/util/header.c
parent3d3b5e95997208067c963923db90ed1517565d14 (diff)
perf tools: Improve support for sessions with multiple events
By creating an perf_evlist out of the attributes in the perf.data file header, so that we can use evlists and evsels when reading recorded sessions in addition to when we record sessions. More work is needed to allow tools to allow the user to select which events are wanted when browsing sessions, be it just one or a subset of them, aggregated or showed at the same time but with different indications on the UI to allow seeing workloads thru different views at the same time. But the overall goal/trend is to more uniformly use evsels and evlists. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r--tools/perf/util/header.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 72c124dc5781..108b0db7bbef 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -969,37 +969,6 @@ bool perf_header__sample_id_all(const struct perf_header *header)
969 return value; 969 return value;
970} 970}
971 971
972struct perf_event_attr *
973perf_header__find_attr(u64 id, struct perf_header *header)
974{
975 int i;
976
977 /*
978 * We set id to -1 if the data file doesn't contain sample
979 * ids. This can happen when the data file contains one type
980 * of event and in that case, the header can still store the
981 * event attribute information. Check for this and avoid
982 * walking through the entire list of ids which may be large.
983 */
984 if (id == -1ULL) {
985 if (header->attrs > 0)
986 return &header->attr[0]->attr;
987 return NULL;
988 }
989
990 for (i = 0; i < header->attrs; i++) {
991 struct perf_header_attr *attr = header->attr[i];
992 int j;
993
994 for (j = 0; j < attr->ids; j++) {
995 if (attr->id[j] == id)
996 return &attr->attr;
997 }
998 }
999
1000 return NULL;
1001}
1002
1003int perf_event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id, 972int perf_event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id,
1004 perf_event__handler_t process, 973 perf_event__handler_t process,
1005 struct perf_session *session) 974 struct perf_session *session)