perf tools: Copy metric events properly when expand cgroups
authorNamhyung Kim <namhyung@kernel.org>
Thu, 24 Sep 2020 12:44:53 +0000 (21:44 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 28 Sep 2020 12:16:21 +0000 (09:16 -0300)
commitb214ba8c4275d66029ad34ad222326dca43e7e26
tree262e4d857b67aae29a6b5d0cce1c934a0dc80f40
parentd1c5a0e86a4e39c9f1bfbfb5ced2ef14103cbf45
perf tools: Copy metric events properly when expand cgroups

The metricgroup__copy_metric_events() is to handle metrics events when
expanding event for cgroups.  As the metric events keep pointers to
evsel, it should be refreshed when events are cloned during the
operation.

The perf_stat__collect_metric_expr() is also called in case an event has
a metric directly.

During the copy, it references evsel by index as the evlist now has
cloned evsels for the given cgroup.

Also kernel test robot found an issue in the python module import so add
empty implementations of those two functions to fix it.

Reported-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.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/20200924124455.336326-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c
tools/perf/util/cgroup.c
tools/perf/util/cgroup.h
tools/perf/util/evlist.c
tools/perf/util/evlist.h
tools/perf/util/metricgroup.c
tools/perf/util/metricgroup.h
tools/perf/util/python.c