Skip to content

Commit

Permalink
perf tools: Add union u64_swap type for swapping u64 data
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: David Ahern <[email protected]>
Tested-by: David Ahern <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
Jiri Olsa authored and acmel committed May 22, 2012
1 parent e108c66 commit 6a11f92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tools/perf/util/evsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* for why this goofiness is needed.
*/
union {
u64 val64;
u32 val32[2];
} u;
union u64_swap u;

memset(data, 0, sizeof(*data));
data->cpu = data->pid = data->tid = -1;
Expand Down Expand Up @@ -608,10 +605,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
* used for cross-endian analysis. See git commit 65014ab3
* for why this goofiness is needed.
*/
union {
u64 val64;
u32 val32[2];
} u;
union u64_swap u;

array = event->sample.array;

Expand Down
5 changes: 5 additions & 0 deletions tools/perf/util/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ typedef signed short s16;
typedef unsigned char u8;
typedef signed char s8;

union u64_swap {
u64 val64;
u32 val32[2];
};

#endif /* __PERF_TYPES_H */

0 comments on commit 6a11f92

Please sign in to comment.