diff options
author | Namhyung Kim <namhyung@kernel.org> | 2020-03-25 15:45:31 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-04-03 15:37:55 +0300 |
commit | d1277aa36bff4bfc1a187a469fc6a6a1d17cf59c (patch) | |
tree | 682d45f57bf534a8eda1195c6b46cb8f7be0953c /tools/perf/util/machine.c | |
parent | ba78c1c5461c2fc2f57b777e971b3a9ec0df5666 (diff) | |
download | linux-d1277aa36bff4bfc1a187a469fc6a6a1d17cf59c.tar.xz |
perf cgroup: Maintain cgroup hierarchy
Each cgroup is kept in the perf_env's cgroup_tree sorted by the cgroup
id. Hist entries have cgroup id can compare it directly and later it
can be used to find a group name using this tree.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200325124536.2800725-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r-- | tools/perf/util/machine.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 399b4731b246..97142e9671be 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -33,6 +33,7 @@ #include "asm/bug.h" #include "bpf-event.h" #include <internal/lib.h> // page_size +#include "cgroup.h" #include <linux/ctype.h> #include <symbol/kallsyms.h> @@ -654,13 +655,19 @@ int machine__process_namespaces_event(struct machine *machine __maybe_unused, return err; } -int machine__process_cgroup_event(struct machine *machine __maybe_unused, +int machine__process_cgroup_event(struct machine *machine, union perf_event *event, struct perf_sample *sample __maybe_unused) { + struct cgroup *cgrp; + if (dump_trace) perf_event__fprintf_cgroup(event, stdout); + cgrp = cgroup__findnew(machine->env, event->cgroup.id, event->cgroup.path); + if (cgrp == NULL) + return -ENOMEM; + return 0; } |