Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223843
b: refs/heads/master
c: baa2f6c
h: refs/heads/master
i:
  223841: 79e60ca
  223839: 0d8a730
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Nov 26, 2010
1 parent 3d42212 commit 8ce0671
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af86da5318136eb49c0453c2e2be3280ee5d18d9
refs/heads/master: baa2f6cedbfae962f04281a31f08ec29667d31a0
14 changes: 11 additions & 3 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static bool inherit_stat = false;
static bool no_samples = false;
static bool sample_address = false;
static bool no_buildid = false;
static bool no_buildid_cache = false;

static long samples = 0;
static u64 bytes_written = 0;
Expand Down Expand Up @@ -437,7 +438,8 @@ static void atexit_header(void)
if (!pipe_output) {
session->header.data_size += bytes_written;

process_buildids();
if (!no_buildid)
process_buildids();
perf_header__write(&session->header, output, true);
perf_session__delete(session);
symbol__exit();
Expand Down Expand Up @@ -557,6 +559,9 @@ static int __cmd_record(int argc, const char **argv)
return -1;
}

if (!no_buildid)
perf_header__set_feat(&session->header, HEADER_BUILD_ID);

if (!file_new) {
err = perf_header__read(session, output);
if (err < 0)
Expand Down Expand Up @@ -831,8 +836,10 @@ const struct option record_options[] = {
"Sample addresses"),
OPT_BOOLEAN('n', "no-samples", &no_samples,
"don't sample"),
OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid,
OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid_cache,
"do not update the buildid cache"),
OPT_BOOLEAN('B', "no-buildid", &no_buildid,
"do not collect buildids in perf.data"),
OPT_END()
};

Expand All @@ -857,7 +864,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
}

symbol__init();
if (no_buildid)

if (no_buildid_cache || no_buildid)
disable_buildid_cache();

if (!nr_counters) {
Expand Down
11 changes: 9 additions & 2 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ void perf_header__set_feat(struct perf_header *self, int feat)
set_bit(feat, self->adds_features);
}

void perf_header__clear_feat(struct perf_header *self, int feat)
{
clear_bit(feat, self->adds_features);
}

bool perf_header__has_feat(const struct perf_header *self, int feat)
{
return test_bit(feat, self->adds_features);
Expand Down Expand Up @@ -431,8 +436,10 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
int idx = 0, err;

session = container_of(self, struct perf_session, header);
if (perf_session__read_build_ids(session, true))
perf_header__set_feat(self, HEADER_BUILD_ID);

if (perf_header__has_feat(self, HEADER_BUILD_ID &&
!perf_session__read_build_ids(session, true)))
perf_header__clear_feat(self, HEADER_BUILD_ID);

nr_sections = bitmap_weight(self->adds_features, HEADER_FEAT_BITS);
if (!nr_sections)
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ u64 perf_header__sample_type(struct perf_header *header);
struct perf_event_attr *
perf_header__find_attr(u64 id, struct perf_header *header);
void perf_header__set_feat(struct perf_header *self, int feat);
void perf_header__clear_feat(struct perf_header *self, int feat);
bool perf_header__has_feat(const struct perf_header *self, int feat);

int perf_header__process_sections(struct perf_header *self, int fd,
Expand Down
5 changes: 5 additions & 0 deletions trunk/tools/perf/util/include/linux/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ static inline void set_bit(int nr, unsigned long *addr)
addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
}

static inline void clear_bit(int nr, unsigned long *addr)
{
addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG));
}

static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
{
return ((1UL << (nr % BITS_PER_LONG)) &
Expand Down

0 comments on commit 8ce0671

Please sign in to comment.