aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-01-03 13:39:04 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-01-03 13:39:04 -0500
commit69aad6f1ee69546dea8535ab8f3da9f445d57328 (patch)
treeb328ec140a6a90703a049fcc661d623025d7e81f /tools/perf/util/header.c
parent56f4c400349157289b474a3fd49ee96acab0a4d7 (diff)
perf tools: Introduce event selectors
Out of ad-hoc code and global arrays with hard coded sizes. This is the first step on having a library that will be first used on regression tests in the 'perf test' tool. [acme@felicio linux]$ size /tmp/perf.before text data bss dec hex filename 1273776 97384 5104416 6475576 62cf38 /tmp/perf.before [acme@felicio linux]$ size /tmp/perf.new text data bss dec hex filename 1275422 97416 1392416 2765254 2a31c6 /tmp/perf.new 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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 16a16021eaa6..ecb5a8444f42 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -461,7 +461,7 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
461 461
462 /* Write trace info */ 462 /* Write trace info */
463 trace_sec->offset = lseek(fd, 0, SEEK_CUR); 463 trace_sec->offset = lseek(fd, 0, SEEK_CUR);
464 read_tracing_data(fd, attrs, nr_counters); 464 read_tracing_data(fd, &evsel_list);
465 trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset; 465 trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset;
466 } 466 }
467 467
@@ -1131,8 +1131,7 @@ int event__process_event_type(event_t *self,
1131 return 0; 1131 return 0;
1132} 1132}
1133 1133
1134int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs, 1134int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
1135 int nb_events,
1136 event__handler_t process, 1135 event__handler_t process,
1137 struct perf_session *session __unused) 1136 struct perf_session *session __unused)
1138{ 1137{
@@ -1143,7 +1142,7 @@ int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs,
1143 memset(&ev, 0, sizeof(ev)); 1142 memset(&ev, 0, sizeof(ev));
1144 1143
1145 ev.tracing_data.header.type = PERF_RECORD_HEADER_TRACING_DATA; 1144 ev.tracing_data.header.type = PERF_RECORD_HEADER_TRACING_DATA;
1146 size = read_tracing_data_size(fd, pattrs, nb_events); 1145 size = read_tracing_data_size(fd, pattrs);
1147 if (size <= 0) 1146 if (size <= 0)
1148 return size; 1147 return size;
1149 aligned_size = ALIGN(size, sizeof(u64)); 1148 aligned_size = ALIGN(size, sizeof(u64));
@@ -1153,7 +1152,7 @@ int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs,
1153 1152
1154 process(&ev, NULL, session); 1153 process(&ev, NULL, session);
1155 1154
1156 err = read_tracing_data(fd, pattrs, nb_events); 1155 err = read_tracing_data(fd, pattrs);
1157 write_padded(fd, NULL, 0, padding); 1156 write_padded(fd, NULL, 0, padding);
1158 1157
1159 return aligned_size; 1158 return aligned_size;