bool                    show_lost_events;
        bool                    show_round_events;
        bool                    show_bpf_events;
+       bool                    show_cgroup_events;
        bool                    allocated;
        bool                    per_event_dump;
        struct evswitch         evswitch;
        return ret;
 }
 
+static int process_cgroup_event(struct perf_tool *tool,
+                               union perf_event *event,
+                               struct perf_sample *sample,
+                               struct machine *machine)
+{
+       struct thread *thread;
+       struct perf_script *script = container_of(tool, struct perf_script, tool);
+       struct perf_session *session = script->session;
+       struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
+       int ret = -1;
+
+       thread = machine__findnew_thread(machine, sample->pid, sample->tid);
+       if (thread == NULL) {
+               pr_debug("problem processing CGROUP event, skipping it.\n");
+               return -1;
+       }
+
+       if (perf_event__process_cgroup(tool, event, sample, machine) < 0)
+               goto out;
+
+       if (!evsel->core.attr.sample_id_all) {
+               sample->cpu = 0;
+               sample->time = 0;
+       }
+       if (!filter_cpu(sample)) {
+               perf_sample__fprintf_start(sample, thread, evsel,
+                                          PERF_RECORD_CGROUP, stdout);
+               perf_event__fprintf(event, stdout);
+       }
+       ret = 0;
+out:
+       thread__put(thread);
+       return ret;
+}
+
 static int process_fork_event(struct perf_tool *tool,
                              union perf_event *event,
                              struct perf_sample *sample,
                script->tool.context_switch = process_switch_event;
        if (script->show_namespace_events)
                script->tool.namespaces = process_namespaces_event;
+       if (script->show_cgroup_events)
+               script->tool.cgroup = process_cgroup_event;
        if (script->show_lost_events)
                script->tool.lost = process_lost_event;
        if (script->show_round_events) {
                        .mmap2           = perf_event__process_mmap2,
                        .comm            = perf_event__process_comm,
                        .namespaces      = perf_event__process_namespaces,
+                       .cgroup          = perf_event__process_cgroup,
                        .exit            = perf_event__process_exit,
                        .fork            = perf_event__process_fork,
                        .attr            = process_attr,
                    "Show context switch events (if recorded)"),
        OPT_BOOLEAN('\0', "show-namespace-events", &script.show_namespace_events,
                    "Show namespace events (if recorded)"),
+       OPT_BOOLEAN('\0', "show-cgroup-events", &script.show_cgroup_events,
+                   "Show cgroup events (if recorded)"),
        OPT_BOOLEAN('\0', "show-lost-events", &script.show_lost_events,
                    "Show lost events (if recorded)"),
        OPT_BOOLEAN('\0', "show-round-events", &script.show_round_events,