perf evsel: Add bitfield_swap() to handle branch_stack endian issue
authorMadhavan Srinivasan <maddy@linux.ibm.com>
Thu, 28 Oct 2021 11:37:13 +0000 (17:07 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 28 Oct 2021 12:33:02 +0000 (09:33 -0300)
commit63c12ae2f246dcdc30895ec7c980365a5133433d
tree377b04fbe28ee674ce6dc6131098f0c4d6966907
parent6ea5d1a3e301a3d1f0364dfd481210aa6aa3cf17
perf evsel: Add bitfield_swap() to handle branch_stack endian issue

The branch_stack struct has bit field definition which produces
different bit ordering for big/little endian.

Because of this, when branch_stack sample is collected in a BE system
and viewed/reported in a LE system, bit fields of the branch stack are
not presented properly.

To address this issue, a evsel__bitfield_swap_branch_stack() is defined
and introduced in evsel__parse_sample.

Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20211028113714.600549-1-maddy@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c
tools/perf/util/evsel.h