aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-record.c4
-rw-r--r--tools/perf/util/header.c12
-rw-r--r--tools/perf/util/header.h1
3 files changed, 4 insertions, 13 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index c35e61b30988..326e8a79cabf 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -431,11 +431,11 @@ static int __cmd_record(int argc, const char **argv)
431 header = perf_header__new(); 431 header = perf_header__new();
432 432
433 if (raw_samples) { 433 if (raw_samples) {
434 perf_header__feat_trace_info(header); 434 perf_header__set_feat(header, HEADER_TRACE_INFO);
435 } else { 435 } else {
436 for (i = 0; i < nr_counters; i++) { 436 for (i = 0; i < nr_counters; i++) {
437 if (attrs[i].sample_type & PERF_SAMPLE_RAW) { 437 if (attrs[i].sample_type & PERF_SAMPLE_RAW) {
438 perf_header__feat_trace_info(header); 438 perf_header__set_feat(header, HEADER_TRACE_INFO);
439 break; 439 break;
440 } 440 }
441 } 441 }
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 915b56edbf02..9709d38113b1 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -148,11 +148,6 @@ struct perf_file_header {
148 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS); 148 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
149}; 149};
150 150
151void perf_header__feat_trace_info(struct perf_header *header)
152{
153 set_bit(HEADER_TRACE_INFO, header->adds_features);
154}
155
156void perf_header__set_feat(struct perf_header *self, int feat) 151void perf_header__set_feat(struct perf_header *self, int feat)
157{ 152{
158 set_bit(feat, self->adds_features); 153 set_bit(feat, self->adds_features);
@@ -195,9 +190,8 @@ perf_header__adds_write(struct perf_header *self, int fd, bool at_exit)
195{ 190{
196 struct perf_file_section trace_sec; 191 struct perf_file_section trace_sec;
197 u64 cur_offset = lseek(fd, 0, SEEK_CUR); 192 u64 cur_offset = lseek(fd, 0, SEEK_CUR);
198 unsigned long *feat_mask = self->adds_features;
199 193
200 if (test_bit(HEADER_TRACE_INFO, feat_mask)) { 194 if (perf_header__has_feat(self, HEADER_TRACE_INFO)) {
201 /* Write trace info */ 195 /* Write trace info */
202 trace_sec.offset = lseek(fd, sizeof(trace_sec), SEEK_CUR); 196 trace_sec.offset = lseek(fd, sizeof(trace_sec), SEEK_CUR);
203 read_tracing_data(fd, attrs, nr_counters); 197 read_tracing_data(fd, attrs, nr_counters);
@@ -314,9 +308,7 @@ static void do_read(int fd, void *buf, size_t size)
314 308
315static void perf_header__adds_read(struct perf_header *self, int fd) 309static void perf_header__adds_read(struct perf_header *self, int fd)
316{ 310{
317 const unsigned long *feat_mask = self->adds_features; 311 if (perf_header__has_feat(self, HEADER_TRACE_INFO)) {
318
319 if (test_bit(HEADER_TRACE_INFO, feat_mask)) {
320 struct perf_file_section trace_sec; 312 struct perf_file_section trace_sec;
321 313
322 do_read(fd, &trace_sec, sizeof(trace_sec)); 314 do_read(fd, &trace_sec, sizeof(trace_sec));
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 77186c9e605b..a22d70b07571 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -49,7 +49,6 @@ void perf_header_attr__add_id(struct perf_header_attr *self, u64 id);
49u64 perf_header__sample_type(struct perf_header *header); 49u64 perf_header__sample_type(struct perf_header *header);
50struct perf_event_attr * 50struct perf_event_attr *
51perf_header__find_attr(u64 id, struct perf_header *header); 51perf_header__find_attr(u64 id, struct perf_header *header);
52void perf_header__feat_trace_info(struct perf_header *header);
53void perf_header__set_feat(struct perf_header *self, int feat); 52void perf_header__set_feat(struct perf_header *self, int feat);
54bool perf_header__has_feat(const struct perf_header *self, int feat); 53bool perf_header__has_feat(const struct perf_header *self, int feat);
55 54