diff options
author | Namhyung Kim <namhyung@kernel.org> | 2019-05-22 01:32:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-05-28 08:52:23 -0400 |
commit | acd244b84b80d53fa2cee98659b55d3f09b4f5a7 (patch) | |
tree | ea6225c2a8204f61408b78e735fb5e67327e1059 /tools | |
parent | 6584140ba9e6762dd7ec73795243289b914f31f9 (diff) |
perf session: Add missing swap ops for namespace events
In case it's recorded in a different arch.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Hari Bathini <hbathini@linux.vnet.ibm.com> <hbathini@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Fixes: f3b3614a284d ("perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info")
Link: http://lkml.kernel.org/r/20190522053250.207156-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/session.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 2310a1752983..54cf163347f7 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -647,6 +647,26 @@ static void perf_event__throttle_swap(union perf_event *event, | |||
647 | swap_sample_id_all(event, &event->throttle + 1); | 647 | swap_sample_id_all(event, &event->throttle + 1); |
648 | } | 648 | } |
649 | 649 | ||
650 | static void perf_event__namespaces_swap(union perf_event *event, | ||
651 | bool sample_id_all) | ||
652 | { | ||
653 | u64 i; | ||
654 | |||
655 | event->namespaces.pid = bswap_32(event->namespaces.pid); | ||
656 | event->namespaces.tid = bswap_32(event->namespaces.tid); | ||
657 | event->namespaces.nr_namespaces = bswap_64(event->namespaces.nr_namespaces); | ||
658 | |||
659 | for (i = 0; i < event->namespaces.nr_namespaces; i++) { | ||
660 | struct perf_ns_link_info *ns = &event->namespaces.link_info[i]; | ||
661 | |||
662 | ns->dev = bswap_64(ns->dev); | ||
663 | ns->ino = bswap_64(ns->ino); | ||
664 | } | ||
665 | |||
666 | if (sample_id_all) | ||
667 | swap_sample_id_all(event, &event->namespaces.link_info[i]); | ||
668 | } | ||
669 | |||
650 | static u8 revbyte(u8 b) | 670 | static u8 revbyte(u8 b) |
651 | { | 671 | { |
652 | int rev = (b >> 4) | ((b & 0xf) << 4); | 672 | int rev = (b >> 4) | ((b & 0xf) << 4); |
@@ -887,6 +907,7 @@ static perf_event__swap_op perf_event__swap_ops[] = { | |||
887 | [PERF_RECORD_LOST_SAMPLES] = perf_event__all64_swap, | 907 | [PERF_RECORD_LOST_SAMPLES] = perf_event__all64_swap, |
888 | [PERF_RECORD_SWITCH] = perf_event__switch_swap, | 908 | [PERF_RECORD_SWITCH] = perf_event__switch_swap, |
889 | [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap, | 909 | [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap, |
910 | [PERF_RECORD_NAMESPACES] = perf_event__namespaces_swap, | ||
890 | [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, | 911 | [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, |
891 | [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, | 912 | [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, |
892 | [PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap, | 913 | [PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap, |