Skip to content

Commit 2c589d9

Browse files
namhyungacmel
authored andcommitted
perf tools: Add missing swap for cgroup events
It was missed to add a swap function for PERF_RECORD_CGROUP. Fixes: ba78c1c ("perf tools: Basic support for CGROUP event") Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20201102140228.303657-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent fe01adb commit 2c589d9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tools/perf/util/session.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,18 @@ static void perf_event__namespaces_swap(union perf_event *event,
711711
swap_sample_id_all(event, &event->namespaces.link_info[i]);
712712
}
713713

714+
static void perf_event__cgroup_swap(union perf_event *event, bool sample_id_all)
715+
{
716+
event->cgroup.id = bswap_64(event->cgroup.id);
717+
718+
if (sample_id_all) {
719+
void *data = &event->cgroup.path;
720+
721+
data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
722+
swap_sample_id_all(event, data);
723+
}
724+
}
725+
714726
static u8 revbyte(u8 b)
715727
{
716728
int rev = (b >> 4) | ((b & 0xf) << 4);
@@ -953,6 +965,7 @@ static perf_event__swap_op perf_event__swap_ops[] = {
953965
[PERF_RECORD_SWITCH] = perf_event__switch_swap,
954966
[PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap,
955967
[PERF_RECORD_NAMESPACES] = perf_event__namespaces_swap,
968+
[PERF_RECORD_CGROUP] = perf_event__cgroup_swap,
956969
[PERF_RECORD_TEXT_POKE] = perf_event__text_poke_swap,
957970
[PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap,
958971
[PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap,

0 commit comments

Comments
 (0)