libperf: Move 'leader' from tools/perf to perf_evsel::leader
authorJiri Olsa <jolsa@redhat.com>
Tue, 6 Jul 2021 15:17:00 +0000 (17:17 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 9 Jul 2021 17:04:31 +0000 (14:04 -0300)
commitfba7c86601e2e42d7057db47bf6d45865a208b8c
tree1126aa034be17f0762186189d02b16700ac8c9e7
parent38fe0e0156c037c060f81fe4e36549fae760322d
libperf: Move 'leader' from tools/perf to perf_evsel::leader

Move evsel::leader to perf_evsel::leader, so we can move the group
interface to libperf.

Also add several evsel helpers to ease up the transition:

  struct evsel *evsel__leader(struct evsel *evsel);
  - get leader evsel

  bool evsel__has_leader(struct evsel *evsel, struct evsel *leader);
  - true if evsel has leader as leader

  bool evsel__is_leader(struct evsel *evsel);
  - true if evsel is itw own leader

  void evsel__set_leader(struct evsel *evsel, struct evsel *leader);
  - set leader for evsel

Committer notes:

Fix this when building with 'make BUILD_BPF_SKEL=1'

  tools/perf/util/bpf_counter.c

  -       if (evsel->leader->core.nr_members > 1) {
  +       if (evsel->core.leader->nr_members > 1) {

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Requested-by: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210706151704.73662-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
20 files changed:
tools/lib/perf/evsel.c
tools/lib/perf/include/internal/evsel.h
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-script.c
tools/perf/builtin-stat.c
tools/perf/builtin-top.c
tools/perf/tests/parse-events.c
tools/perf/util/auxtrace.c
tools/perf/util/bpf_counter.c
tools/perf/util/cgroup.c
tools/perf/util/evlist.c
tools/perf/util/evsel.c
tools/perf/util/evsel.h
tools/perf/util/header.c
tools/perf/util/metricgroup.c
tools/perf/util/parse-events.c
tools/perf/util/record.c
tools/perf/util/stat-shadow.c
tools/perf/util/stat.c