[PATCH v20 01/21] perf util: Sort includes and add missed explicit dependencies
From: Ian Rogers <irogers@google.com>
Date: 2026-06-15 22:30:24
Also in:
lkml
Subsystem:
performance events subsystem, the rest · Maintainers:
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds
Fix missing includes found while cleaning the evsel/evlist header files. Sort the remaining header files for consistency with the rest of the code. Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/util/bpf_off_cpu.c | 30 +++++----- tools/perf/util/bpf_trace_augment.c | 8 +-- tools/perf/util/evlist.c | 91 +++++++++++++++-------------- tools/perf/util/map.h | 9 ++- tools/perf/util/perf_api_probe.c | 18 +++--- tools/perf/util/s390-sample-raw.c | 19 +++--- tools/perf/util/stat-shadow.c | 20 ++++--- tools/perf/util/stat.c | 16 +++-- 8 files changed, 113 insertions(+), 98 deletions(-)
diff --git a/tools/perf/util/bpf_off_cpu.c b/tools/perf/util/bpf_off_cpu.c
index a3b699a5322f..48cb930cdd2e 100644
--- a/tools/perf/util/bpf_off_cpu.c
+++ b/tools/perf/util/bpf_off_cpu.c@@ -1,23 +1,25 @@ // SPDX-License-Identifier: GPL-2.0 -#include "util/bpf_counter.h" -#include "util/debug.h" -#include "util/evsel.h" -#include "util/evlist.h" -#include "util/off_cpu.h" -#include "util/perf-hooks.h" -#include "util/record.h" -#include "util/session.h" -#include "util/target.h" -#include "util/cpumap.h" -#include "util/thread_map.h" -#include "util/cgroup.h" -#include "util/strlist.h" +#include <linux/time64.h> + #include <bpf/bpf.h> #include <bpf/btf.h> #include <internal/xyarray.h> -#include <linux/time64.h> +#include "bpf_counter.h" #include "bpf_skel/off_cpu.skel.h" +#include "cgroup.h" +#include "cpumap.h" +#include "debug.h" +#include "evlist.h" +#include "evsel.h" +#include "off_cpu.h" +#include "parse-events.h" +#include "perf-hooks.h" +#include "record.h" +#include "session.h" +#include "strlist.h" +#include "target.h" +#include "thread_map.h" #define MAX_STACKS 32 #define MAX_PROC 4096
diff --git a/tools/perf/util/bpf_trace_augment.c b/tools/perf/util/bpf_trace_augment.c
index 9e706f0fa53d..a9cf2a77ded1 100644
--- a/tools/perf/util/bpf_trace_augment.c
+++ b/tools/perf/util/bpf_trace_augment.c@@ -1,11 +1,11 @@ #include <bpf/libbpf.h> #include <internal/xyarray.h> -#include "util/debug.h" -#include "util/evlist.h" -#include "util/trace_augment.h" - #include "bpf_skel/augmented_raw_syscalls.skel.h" +#include "debug.h" +#include "evlist.h" +#include "parse-events.h" +#include "trace_augment.h" static struct augmented_raw_syscalls_bpf *skel; static struct evsel *bpf_output;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 1a238b245b3a..ab6bf5e935f4 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c@@ -5,67 +5,68 @@ * Parts came from builtin-{top,stat,record}.c, see those files for further * copyright notes. */ -#include <api/fs/fs.h> +#include "evlist.h" + #include <errno.h> #include <inttypes.h> -#include <poll.h> -#include "cpumap.h" -#include "util/mmap.h" -#include "thread_map.h" -#include "target.h" -#include "dwarf-regs.h" -#include "evlist.h" -#include "evsel.h" -#include "record.h" -#include "debug.h" -#include "units.h" -#include "bpf_counter.h" -#include <internal/lib.h> // page_size -#include "affinity.h" -#include "../perf.h" -#include "asm/bug.h" -#include "bpf-event.h" -#include "util/event.h" -#include "util/string2.h" -#include "util/perf_api_probe.h" -#include "util/evsel_fprintf.h" -#include "util/pmu.h" -#include "util/sample.h" -#include "util/bpf-filter.h" -#include "util/stat.h" -#include "util/util.h" -#include "util/env.h" -#include "util/intel-tpebs.h" -#include "util/metricgroup.h" -#include "util/strbuf.h" #include <signal.h> -#include <unistd.h> -#include <sched.h> #include <stdlib.h> -#include "parse-events.h" -#include <subcmd/parse-options.h> - #include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <sys/prctl.h> -#include <sys/timerfd.h> -#include <sys/wait.h> - #include <linux/bitops.h> +#include <linux/err.h> #include <linux/hash.h> #include <linux/log2.h> -#include <linux/err.h> #include <linux/string.h> #include <linux/time64.h> #include <linux/zalloc.h> +#include <poll.h> +#include <sched.h> +#include <sys/ioctl.h> +#include <sys/mman.h> +#include <sys/prctl.h> +#include <sys/timerfd.h> +#include <sys/wait.h> +#include <unistd.h> + +#include <api/fs/fs.h> +#include <internal/lib.h> // page_size +#include <internal/xyarray.h> +#include <perf/cpumap.h> #include <perf/evlist.h> #include <perf/evsel.h> -#include <perf/cpumap.h> #include <perf/mmap.h> +#include <subcmd/parse-options.h> -#include <internal/xyarray.h> +#include "../perf.h" +#include "affinity.h" +#include "asm/bug.h" +#include "bpf-event.h" +#include "bpf-filter.h" +#include "bpf_counter.h" +#include "cpumap.h" +#include "debug.h" +#include "dwarf-regs.h" +#include "env.h" +#include "event.h" +#include "evsel.h" +#include "evsel_fprintf.h" +#include "intel-tpebs.h" +#include "metricgroup.h" +#include "mmap.h" +#include "parse-events.h" +#include "perf_api_probe.h" +#include "pmu.h" +#include "pmus.h" +#include "record.h" +#include "sample.h" +#include "stat.h" +#include "strbuf.h" +#include "string2.h" +#include "target.h" +#include "thread_map.h" +#include "units.h" +#include "util.h" #ifdef LACKS_SIGQUEUE_PROTOTYPE int sigqueue(pid_t pid, int sig, const union sigval value);
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 979b3e11b9bc..fb0279810ae9 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h@@ -2,14 +2,13 @@ #ifndef __PERF_MAP_H #define __PERF_MAP_H -#include <linux/refcount.h> -#include <linux/compiler.h> -#include <linux/list.h> -#include <linux/rbtree.h> +#include <stdbool.h> #include <stdio.h> #include <string.h> -#include <stdbool.h> + +#include <linux/refcount.h> #include <linux/types.h> + #include <internal/rc_check.h> struct dso;
diff --git a/tools/perf/util/perf_api_probe.c b/tools/perf/util/perf_api_probe.c
index 6ecf38314f01..e1904a330b28 100644
--- a/tools/perf/util/perf_api_probe.c
+++ b/tools/perf/util/perf_api_probe.c@@ -1,14 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#include "perf_api_probe.h" -#include "perf-sys.h" -#include "util/cloexec.h" -#include "util/evlist.h" -#include "util/evsel.h" -#include "util/parse-events.h" -#include "util/perf_api_probe.h" -#include <perf/cpumap.h> #include <errno.h> +#include <perf/cpumap.h> + +#include "cloexec.h" +#include "evlist.h" +#include "evsel.h" +#include "parse-events.h" +#include "perf-sys.h" +#include "pmu.h" +#include "pmus.h" + typedef void (*setup_probe_fn_t)(struct evsel *evsel); static int perf_do_probe_api(setup_probe_fn_t fn, struct perf_cpu cpu, const char *str)
diff --git a/tools/perf/util/s390-sample-raw.c b/tools/perf/util/s390-sample-raw.c
index 52bbca5c56c8..01111c4e3488 100644
--- a/tools/perf/util/s390-sample-raw.c
+++ b/tools/perf/util/s390-sample-raw.c@@ -12,25 +12,26 @@ * sample was taken from. */ -#include <unistd.h> +#include <inttypes.h> #include <stdio.h> #include <string.h> -#include <inttypes.h> -#include <sys/stat.h> +#include <asm/byteorder.h> #include <linux/compiler.h> #include <linux/err.h> -#include <asm/byteorder.h> +#include <sys/stat.h> +#include <unistd.h> +#include "color.h" #include "debug.h" -#include "session.h" #include "evlist.h" -#include "color.h" #include "hashmap.h" -#include "sample-raw.h" +#include "pmu.h" +#include "pmus.h" #include "s390-cpumcf-kernel.h" -#include "util/pmu.h" -#include "util/sample.h" +#include "sample-raw.h" +#include "sample.h" +#include "session.h" static size_t ctrset_size(struct cf_ctrset_entry *set) {
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index c17373bb0e1e..35062f964618 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c@@ -2,20 +2,24 @@ #include <errno.h> #include <math.h> #include <stdio.h> -#include "evsel.h" -#include "stat.h" + +#include <linux/zalloc.h> + +#include "cgroup.h" #include "color.h" #include "debug.h" -#include "pmu.h" -#include "rblist.h" #include "evlist.h" +#include "evsel.h" #include "expr.h" -#include "metricgroup.h" -#include "cgroup.h" -#include "units.h" +#include "hashmap.h" #include "iostat.h" -#include "util/hashmap.h" +#include "metricgroup.h" +#include "pmu.h" +#include "pmus.h" +#include "rblist.h" +#include "stat.h" #include "tool_pmu.h" +#include "units.h" static bool tool_pmu__is_time_event(const struct perf_stat_config *config, const struct evsel *evsel, int *tool_aggr_idx)
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 14d169e22e8f..66eb9a66a4f7 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c@@ -1,21 +1,25 @@ // SPDX-License-Identifier: GPL-2.0 +#include "stat.h" + #include <errno.h> -#include <linux/err.h> #include <inttypes.h> #include <math.h> #include <string.h> + +#include <linux/err.h> +#include <linux/zalloc.h> + #include "counts.h" #include "cpumap.h" #include "debug.h" +#include "evlist.h" +#include "evsel.h" +#include "hashmap.h" #include "header.h" -#include "stat.h" +#include "pmu.h" #include "session.h" #include "target.h" -#include "evlist.h" -#include "evsel.h" #include "thread_map.h" -#include "util/hashmap.h" -#include <linux/zalloc.h> void update_stats(struct stats *stats, u64 val) {
--
2.54.0.1136.gdb2ca164c4-goog