Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310595
b: refs/heads/master
c: 37073f9
h: refs/heads/master
i:
  310593: 143a317
  310591: 01b4ff9
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed May 31, 2012
1 parent 57a63e1 commit d9d9e62
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 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: 268fb20f832e1eb4afd5113ee31fef9332986b13
refs/heads/master: 37073f9e449bc430e6c40b9cffc2558002a0256a
29 changes: 22 additions & 7 deletions trunk/tools/perf/util/evsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,24 @@ int perf_evsel__open_per_thread(struct perf_evsel *evsel,
}

static int perf_event__parse_id_sample(const union perf_event *event, u64 type,
struct perf_sample *sample)
struct perf_sample *sample,
bool swapped)
{
const u64 *array = event->sample.array;
union u64_swap u;

array += ((event->header.size -
sizeof(event->header)) / sizeof(u64)) - 1;

if (type & PERF_SAMPLE_CPU) {
u32 *p = (u32 *)array;
sample->cpu = *p;
u.val64 = *array;
if (swapped) {
/* undo swap of u64, then swap on individual u32s */
u.val64 = bswap_64(u.val64);
u.val32[0] = bswap_32(u.val32[0]);
}

sample->cpu = u.val32[0];
array--;
}

Expand All @@ -523,9 +531,16 @@ static int perf_event__parse_id_sample(const union perf_event *event, u64 type,
}

if (type & PERF_SAMPLE_TID) {
u32 *p = (u32 *)array;
sample->pid = p[0];
sample->tid = p[1];
u.val64 = *array;
if (swapped) {
/* undo swap of u64, then swap on individual u32s */
u.val64 = bswap_64(u.val64);
u.val32[0] = bswap_32(u.val32[0]);
u.val32[1] = bswap_32(u.val32[1]);
}

sample->pid = u.val32[0];
sample->tid = u.val32[1];
}

return 0;
Expand Down Expand Up @@ -562,7 +577,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
if (event->header.type != PERF_RECORD_SAMPLE) {
if (!sample_id_all)
return 0;
return perf_event__parse_id_sample(event, type, data);
return perf_event__parse_id_sample(event, type, data, swapped);
}

array = event->sample.array;
Expand Down

0 comments on commit d9d9e62

Please sign in to comment.