Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277288
b: refs/heads/master
c: 81e36bf
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Nov 28, 2011
1 parent 9b64626 commit c1c523a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 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: d04b35f8085f0d4c5c874515b8f65e7664357148
refs/heads/master: 81e36bffad95e015af9741b5b1ee16afe08aab05
32 changes: 32 additions & 0 deletions trunk/tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,38 @@ u64 perf_evlist__sample_type(const struct perf_evlist *evlist)
return first->attr.sample_type;
}

u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist)
{
struct perf_evsel *first;
struct perf_sample *data;
u64 sample_type;
u16 size = 0;

first = list_entry(evlist->entries.next, struct perf_evsel, node);

if (!first->attr.sample_id_all)
goto out;

sample_type = first->attr.sample_type;

if (sample_type & PERF_SAMPLE_TID)
size += sizeof(data->tid) * 2;

if (sample_type & PERF_SAMPLE_TIME)
size += sizeof(data->time);

if (sample_type & PERF_SAMPLE_ID)
size += sizeof(data->id);

if (sample_type & PERF_SAMPLE_STREAM_ID)
size += sizeof(data->stream_id);

if (sample_type & PERF_SAMPLE_CPU)
size += sizeof(data->cpu) * 2;
out:
return size;
}

bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist)
{
struct perf_evsel *pos, *first;
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/evlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ int perf_evlist__set_filters(struct perf_evlist *evlist);

u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist);

bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
Expand Down
29 changes: 1 addition & 28 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,39 +78,12 @@ static int perf_session__open(struct perf_session *self, bool force)
return -1;
}

static void perf_session__id_header_size(struct perf_session *session)
{
struct perf_sample *data;
u64 sample_type = session->sample_type;
u16 size = 0;

if (!session->sample_id_all)
goto out;

if (sample_type & PERF_SAMPLE_TID)
size += sizeof(data->tid) * 2;

if (sample_type & PERF_SAMPLE_TIME)
size += sizeof(data->time);

if (sample_type & PERF_SAMPLE_ID)
size += sizeof(data->id);

if (sample_type & PERF_SAMPLE_STREAM_ID)
size += sizeof(data->stream_id);

if (sample_type & PERF_SAMPLE_CPU)
size += sizeof(data->cpu) * 2;
out:
session->id_hdr_size = size;
}

void perf_session__update_sample_type(struct perf_session *self)
{
self->sample_type = perf_evlist__sample_type(self->evlist);
self->sample_size = __perf_evsel__sample_size(self->sample_type);
self->sample_id_all = perf_evlist__sample_id_all(self->evlist);
perf_session__id_header_size(self);
self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist);
}

int perf_session__create_kernel_maps(struct perf_session *self)
Expand Down

0 comments on commit c1c523a

Please sign in to comment.