aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-record.c14
-rw-r--r--tools/perf/util/header.c11
-rw-r--r--tools/perf/util/header.h1
-rw-r--r--tools/perf/util/include/linux/bitops.h5
4 files changed, 26 insertions, 5 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3d2cb4899807..024e1441d76b 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -61,6 +61,7 @@ static bool inherit_stat = false;
61static bool no_samples = false; 61static bool no_samples = false;
62static bool sample_address = false; 62static bool sample_address = false;
63static bool no_buildid = false; 63static bool no_buildid = false;
64static bool no_buildid_cache = false;
64 65
65static long samples = 0; 66static long samples = 0;
66static u64 bytes_written = 0; 67static u64 bytes_written = 0;
@@ -437,7 +438,8 @@ static void atexit_header(void)
437 if (!pipe_output) { 438 if (!pipe_output) {
438 session->header.data_size += bytes_written; 439 session->header.data_size += bytes_written;
439 440
440 process_buildids(); 441 if (!no_buildid)
442 process_buildids();
441 perf_header__write(&session->header, output, true); 443 perf_header__write(&session->header, output, true);
442 perf_session__delete(session); 444 perf_session__delete(session);
443 symbol__exit(); 445 symbol__exit();
@@ -557,6 +559,9 @@ static int __cmd_record(int argc, const char **argv)
557 return -1; 559 return -1;
558 } 560 }
559 561
562 if (!no_buildid)
563 perf_header__set_feat(&session->header, HEADER_BUILD_ID);
564
560 if (!file_new) { 565 if (!file_new) {
561 err = perf_header__read(session, output); 566 err = perf_header__read(session, output);
562 if (err < 0) 567 if (err < 0)
@@ -831,8 +836,10 @@ const struct option record_options[] = {
831 "Sample addresses"), 836 "Sample addresses"),
832 OPT_BOOLEAN('n', "no-samples", &no_samples, 837 OPT_BOOLEAN('n', "no-samples", &no_samples,
833 "don't sample"), 838 "don't sample"),
834 OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid, 839 OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid_cache,
835 "do not update the buildid cache"), 840 "do not update the buildid cache"),
841 OPT_BOOLEAN('B', "no-buildid", &no_buildid,
842 "do not collect buildids in perf.data"),
836 OPT_END() 843 OPT_END()
837}; 844};
838 845
@@ -857,7 +864,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
857 } 864 }
858 865
859 symbol__init(); 866 symbol__init();
860 if (no_buildid) 867
868 if (no_buildid_cache || no_buildid)
861 disable_buildid_cache(); 869 disable_buildid_cache();
862 870
863 if (!nr_counters) { 871 if (!nr_counters) {
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d7e67b167ea3..f65d7dc127b6 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -152,6 +152,11 @@ void perf_header__set_feat(struct perf_header *self, int feat)
152 set_bit(feat, self->adds_features); 152 set_bit(feat, self->adds_features);
153} 153}
154 154
155void perf_header__clear_feat(struct perf_header *self, int feat)
156{
157 clear_bit(feat, self->adds_features);
158}
159
155bool perf_header__has_feat(const struct perf_header *self, int feat) 160bool perf_header__has_feat(const struct perf_header *self, int feat)
156{ 161{
157 return test_bit(feat, self->adds_features); 162 return test_bit(feat, self->adds_features);
@@ -431,8 +436,10 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
431 int idx = 0, err; 436 int idx = 0, err;
432 437
433 session = container_of(self, struct perf_session, header); 438 session = container_of(self, struct perf_session, header);
434 if (perf_session__read_build_ids(session, true)) 439
435 perf_header__set_feat(self, HEADER_BUILD_ID); 440 if (perf_header__has_feat(self, HEADER_BUILD_ID &&
441 !perf_session__read_build_ids(session, true)))
442 perf_header__clear_feat(self, HEADER_BUILD_ID);
436 443
437 nr_sections = bitmap_weight(self->adds_features, HEADER_FEAT_BITS); 444 nr_sections = bitmap_weight(self->adds_features, HEADER_FEAT_BITS);
438 if (!nr_sections) 445 if (!nr_sections)
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 402ac2454cf8..ed550bffd655 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -84,6 +84,7 @@ u64 perf_header__sample_type(struct perf_header *header);
84struct perf_event_attr * 84struct perf_event_attr *
85perf_header__find_attr(u64 id, struct perf_header *header); 85perf_header__find_attr(u64 id, struct perf_header *header);
86void perf_header__set_feat(struct perf_header *self, int feat); 86void perf_header__set_feat(struct perf_header *self, int feat);
87void perf_header__clear_feat(struct perf_header *self, int feat);
87bool perf_header__has_feat(const struct perf_header *self, int feat); 88bool perf_header__has_feat(const struct perf_header *self, int feat);
88 89
89int perf_header__process_sections(struct perf_header *self, int fd, 90int perf_header__process_sections(struct perf_header *self, int fd,
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
index bb4ac2e05385..8be0b968ca0b 100644
--- a/tools/perf/util/include/linux/bitops.h
+++ b/tools/perf/util/include/linux/bitops.h
@@ -13,6 +13,11 @@ static inline void set_bit(int nr, unsigned long *addr)
13 addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG); 13 addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
14} 14}
15 15
16static inline void clear_bit(int nr, unsigned long *addr)
17{
18 addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG));
19}
20
16static __always_inline int test_bit(unsigned int nr, const unsigned long *addr) 21static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
17{ 22{
18 return ((1UL << (nr % BITS_PER_LONG)) & 23 return ((1UL << (nr % BITS_PER_LONG)) &