perf bpf_counter: Move common functions to bpf_counter.h
authorNamhyung Kim <namhyung@kernel.org>
Fri, 25 Jun 2021 07:18:25 +0000 (00:18 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 1 Jul 2021 19:14:19 +0000 (16:14 -0300)
commitd6a735ef3277c45f48c911b98669174bc4b650d9
treee0038ac2f047c4a753485631f77c83c5ae094d22
parent21bcc7266129a68919438934a37c8793a528ff2b
perf bpf_counter: Move common functions to bpf_counter.h

Some helper functions will be used for cgroup counting too.  Move them
to a header file for sharing.

Committer notes:

Fix the build on older systems with:

  -       struct bpf_map_info map_info = {0};
  +       struct bpf_map_info map_info = { .id = 0, };

This wasn't breaking the build in such systems as bpf_counter.c isn't
built due to:

tools/perf/util/Build:

  perf-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o

The bpf_counter.h file on the other hand is included from places that
are built everywhere.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20210625071826.608504-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/bpf_counter.c
tools/perf/util/bpf_counter.h