diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-05-16 02:59:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-22 11:50:25 -0400 |
commit | 6a11f92ef449bfb87f93e7cc14cb2a717afc7aa3 (patch) | |
tree | 1be870956fc0f32e4eb45ded9667cf565fc9e695 /tools | |
parent | e108c66e2c458f89931189a63a67ad16880d7f51 (diff) |
perf tools: Add union u64_swap type for swapping u64 data
The following union:
union {
u64 val64;
u32 val32[2];
} u;
is used on more than one place in perf code and will be used more in
upcomming patches.
Adding union u64_swap to have it defined globaly so we dont need to
redefine it all the time.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1337151548-2396-4-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/evsel.c | 10 | ||||
-rw-r--r-- | tools/perf/util/types.h | 5 |
2 files changed, 7 insertions, 8 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 9abd8ac508e2..57e4ce57bbcc 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -462,10 +462,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, | |||
462 | * used for cross-endian analysis. See git commit 65014ab3 | 462 | * used for cross-endian analysis. See git commit 65014ab3 |
463 | * for why this goofiness is needed. | 463 | * for why this goofiness is needed. |
464 | */ | 464 | */ |
465 | union { | 465 | union u64_swap u; |
466 | u64 val64; | ||
467 | u32 val32[2]; | ||
468 | } u; | ||
469 | 466 | ||
470 | memset(data, 0, sizeof(*data)); | 467 | memset(data, 0, sizeof(*data)); |
471 | data->cpu = data->pid = data->tid = -1; | 468 | data->cpu = data->pid = data->tid = -1; |
@@ -608,10 +605,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, | |||
608 | * used for cross-endian analysis. See git commit 65014ab3 | 605 | * used for cross-endian analysis. See git commit 65014ab3 |
609 | * for why this goofiness is needed. | 606 | * for why this goofiness is needed. |
610 | */ | 607 | */ |
611 | union { | 608 | union u64_swap u; |
612 | u64 val64; | ||
613 | u32 val32[2]; | ||
614 | } u; | ||
615 | 609 | ||
616 | array = event->sample.array; | 610 | array = event->sample.array; |
617 | 611 | ||
diff --git a/tools/perf/util/types.h b/tools/perf/util/types.h index 5f3689a3d085..c51fa6b70a28 100644 --- a/tools/perf/util/types.h +++ b/tools/perf/util/types.h | |||
@@ -16,4 +16,9 @@ typedef signed short s16; | |||
16 | typedef unsigned char u8; | 16 | typedef unsigned char u8; |
17 | typedef signed char s8; | 17 | typedef signed char s8; |
18 | 18 | ||
19 | union u64_swap { | ||
20 | u64 val64; | ||
21 | u32 val32[2]; | ||
22 | }; | ||
23 | |||
19 | #endif /* __PERF_TYPES_H */ | 24 | #endif /* __PERF_TYPES_H */ |