Commit 6a11f92e authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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: default avatarJiri Olsa <jolsa@redhat.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Tested-by: default avatarDavid 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e108c66e
...@@ -462,10 +462,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, ...@@ -462,10 +462,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
* used for cross-endian analysis. See git commit 65014ab3 * used for cross-endian analysis. See git commit 65014ab3
* for why this goofiness is needed. * for why this goofiness is needed.
*/ */
union { union u64_swap u;
u64 val64;
u32 val32[2];
} u;
memset(data, 0, sizeof(*data)); memset(data, 0, sizeof(*data));
data->cpu = data->pid = data->tid = -1; data->cpu = data->pid = data->tid = -1;
...@@ -608,10 +605,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, ...@@ -608,10 +605,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
* used for cross-endian analysis. See git commit 65014ab3 * used for cross-endian analysis. See git commit 65014ab3
* for why this goofiness is needed. * for why this goofiness is needed.
*/ */
union { union u64_swap u;
u64 val64;
u32 val32[2];
} u;
array = event->sample.array; array = event->sample.array;
......
...@@ -16,4 +16,9 @@ typedef signed short s16; ...@@ -16,4 +16,9 @@ typedef signed short s16;
typedef unsigned char u8; typedef unsigned char u8;
typedef signed char s8; typedef signed char s8;
union u64_swap {
u64 val64;
u32 val32[2];
};
#endif /* __PERF_TYPES_H */ #endif /* __PERF_TYPES_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment