aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
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;