aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-01-11 17:56:53 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-01-22 16:56:28 -0500
commit361c99a661a78ed22264649440e87fe4fe8da1f2 (patch)
treea60bc86f132608f2d41c800760b41f6f54f8e7af /tools/perf/util/header.c
parent00e99a49f6f3a6b5a84ba8bf8f632c9b974bea7a (diff)
perf evsel: Introduce perf_evlist
Killing two more perf wide global variables: nr_counters and evsel_list as a list_head. There are more operations that will need more fields in perf_evlist, like the pollfd for polling all the fds in a list of evsel instances. Use option->value to pass the evsel_list to parse_{events,filters}. LKML-Reference: <new-submission> 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> 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.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index f6a929e74981..f0138d472339 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -8,6 +8,7 @@
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10 10
11#include "evlist.h"
11#include "util.h" 12#include "util.h"
12#include "header.h" 13#include "header.h"
13#include "../perf.h" 14#include "../perf.h"
@@ -428,7 +429,8 @@ static bool perf_session__read_build_ids(struct perf_session *self, bool with_hi
428 return ret; 429 return ret;
429} 430}
430 431
431static int perf_header__adds_write(struct perf_header *self, int fd) 432static int perf_header__adds_write(struct perf_header *self,
433 struct perf_evlist *evlist, int fd)
432{ 434{
433 int nr_sections; 435 int nr_sections;
434 struct perf_session *session; 436 struct perf_session *session;
@@ -463,7 +465,7 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
463 465
464 /* Write trace info */ 466 /* Write trace info */
465 trace_sec->offset = lseek(fd, 0, SEEK_CUR); 467 trace_sec->offset = lseek(fd, 0, SEEK_CUR);
466 read_tracing_data(fd, &evsel_list); 468 read_tracing_data(fd, &evlist->entries);
467 trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset; 469 trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset;
468 } 470 }
469 471
@@ -513,7 +515,8 @@ int perf_header__write_pipe(int fd)
513 return 0; 515 return 0;
514} 516}
515 517
516int perf_header__write(struct perf_header *self, int fd, bool at_exit) 518int perf_header__write(struct perf_header *self, struct perf_evlist *evlist,
519 int fd, bool at_exit)
517{ 520{
518 struct perf_file_header f_header; 521 struct perf_file_header f_header;
519 struct perf_file_attr f_attr; 522 struct perf_file_attr f_attr;
@@ -566,7 +569,7 @@ int perf_header__write(struct perf_header *self, int fd, bool at_exit)
566 self->data_offset = lseek(fd, 0, SEEK_CUR); 569 self->data_offset = lseek(fd, 0, SEEK_CUR);
567 570
568 if (at_exit) { 571 if (at_exit) {
569 err = perf_header__adds_write(self, fd); 572 err = perf_header__adds_write(self, evlist, fd);
570 if (err < 0) 573 if (err < 0)
571 return err; 574 return err;
572 } 575 }
@@ -1133,7 +1136,7 @@ int event__process_event_type(event_t *self,
1133 return 0; 1136 return 0;
1134} 1137}
1135 1138
1136int event__synthesize_tracing_data(int fd, struct list_head *pattrs, 1139int event__synthesize_tracing_data(int fd, struct perf_evlist *evlist,
1137 event__handler_t process, 1140 event__handler_t process,
1138 struct perf_session *session __unused) 1141 struct perf_session *session __unused)
1139{ 1142{
@@ -1144,7 +1147,7 @@ int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
1144 memset(&ev, 0, sizeof(ev)); 1147 memset(&ev, 0, sizeof(ev));
1145 1148
1146 ev.tracing_data.header.type = PERF_RECORD_HEADER_TRACING_DATA; 1149 ev.tracing_data.header.type = PERF_RECORD_HEADER_TRACING_DATA;
1147 size = read_tracing_data_size(fd, pattrs); 1150 size = read_tracing_data_size(fd, &evlist->entries);
1148 if (size <= 0) 1151 if (size <= 0)
1149 return size; 1152 return size;
1150 aligned_size = ALIGN(size, sizeof(u64)); 1153 aligned_size = ALIGN(size, sizeof(u64));
@@ -1154,7 +1157,7 @@ int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
1154 1157
1155 process(&ev, NULL, session); 1158 process(&ev, NULL, session);
1156 1159
1157 err = read_tracing_data(fd, pattrs); 1160 err = read_tracing_data(fd, &evlist->entries);
1158 write_padded(fd, NULL, 0, padding); 1161 write_padded(fd, NULL, 0, padding);
1159 1162
1160 return aligned_size; 1163 return aligned_size;