diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-11-10 22:51:06 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-11 01:30:19 -0500 |
commit | 3e13ab2d83b6867a20663c73c184f29c2fde1558 (patch) | |
tree | d0c67b84db78934e5a8c634261d0df017f0038fb /tools/perf/util/header.c | |
parent | 4778d2e4f410c6eea32f594cb2be9590bcb28b84 (diff) |
perf tools: Use perf_header__set/has_feat whenever possible
And drop the alternate checks/sets using set_bit or other kind
of helpers.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
LKML-Reference: <1257911467-28276-5-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 12 |
1 files changed, 2 insertions, 10 deletions
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 | ||
151 | void perf_header__feat_trace_info(struct perf_header *header) | ||
152 | { | ||
153 | set_bit(HEADER_TRACE_INFO, header->adds_features); | ||
154 | } | ||
155 | |||
156 | void perf_header__set_feat(struct perf_header *self, int feat) | 151 | void 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 | ||
315 | static void perf_header__adds_read(struct perf_header *self, int fd) | 309 | static 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)); |