perf auxtrace: Uninline functions that touch perf_session
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 30 Aug 2019 17:45:20 +0000 (14:45 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 1 Sep 2019 01:24:10 +0000 (22:24 -0300)
So that we don't carry the session.h include directive in auxtrace.h,
which in turn opens a can of worms of files that were getting all sorts
of things via that include, fix them all.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-d2d83aovpgri2z75wlitquni@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
41 files changed:
tools/perf/arch/arm/annotate/instructions.c
tools/perf/arch/arm/util/cs-etm.c
tools/perf/arch/arm64/annotate/instructions.c
tools/perf/arch/x86/tests/perf-time-to-tsc.c
tools/perf/builtin-ftrace.c
tools/perf/tests/backward-ring-buffer.c
tools/perf/tests/bpf.c
tools/perf/tests/builtin-test.c
tools/perf/tests/code-reading.c
tools/perf/tests/event-times.c
tools/perf/tests/event_update.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/parse-events.c
tools/perf/tests/switch-tracking.c
tools/perf/ui/browsers/hists.c
tools/perf/ui/browsers/res_sample.c
tools/perf/ui/browsers/scripts.c
tools/perf/ui/hist.c
tools/perf/ui/stdio/hist.c
tools/perf/util/annotate.c
tools/perf/util/auxtrace.c
tools/perf/util/auxtrace.h
tools/perf/util/bpf-loader.c
tools/perf/util/cgroup.c
tools/perf/util/config.c
tools/perf/util/cs-etm.c
tools/perf/util/cs-etm.h
tools/perf/util/dso.c
tools/perf/util/evlist.c
tools/perf/util/evsel.c
tools/perf/util/machine.c
tools/perf/util/mmap.c
tools/perf/util/mmap.h
tools/perf/util/python.c
tools/perf/util/record.c
tools/perf/util/s390-sample-raw.c
tools/perf/util/sort.c
tools/perf/util/stat-display.c
tools/perf/util/stat.c
tools/perf/util/top.h

index c7d1a69b894fef7e711b9ef72941f0feba386d95..e1d4b484cc4bf4cce60fad06e28cd67c8b754a9b 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/zalloc.h>
 #include <sys/types.h>
 #include <regex.h>
+#include <stdlib.h>
 
 struct arm_annotate {
        regex_t call_insn,
index 59e44f90dc46c8bfa836fa016af0dac83070988a..c32db09baf0d13fabfc190373cbe003e46919743 100644 (file)
@@ -26,6 +26,7 @@
 #include "../../util/pmu.h"
 #include "../../util/cs-etm.h"
 #include "../../util/util.h"
+#include "../../util/session.h"
 
 #include <errno.h>
 #include <stdlib.h>
index 8f70a1b282dfbc25edde9a0f133542e2411cedd4..43aa93ed8414d2649b4321a7c5886240d167dc9b 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/compiler.h>
 #include <sys/types.h>
 #include <regex.h>
+#include <stdlib.h>
 
 struct arm64_annotate {
        regex_t call_insn,
index 2d1f4713b7282bee432d61836c80f932304a7a74..eb3635941c2b905da1bf7e0e4b86b66d31e77d66 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <errno.h>
 #include <inttypes.h>
+#include <limits.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <unistd.h>
index 2f8ea44c00c464632eb5f2347abc829692f63ed0..d5adc417a4ca4a77839de5ca7528f29944ecbef2 100644 (file)
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <signal.h>
+#include <stdlib.h>
 #include <fcntl.h>
 #include <poll.h>
 #include <linux/capability.h>
index 512288e9f547f44047cc4c70473a918569d85f89..a637a4a90760676b0ab22ca6e562afeeb772c235 100644 (file)
@@ -9,6 +9,7 @@
 #include "record.h"
 #include "tests.h"
 #include "debug.h"
+#include "parse-events.h"
 #include <errno.h>
 #include <linux/string.h>
 
index 9fc163b2acbb446a1756c9bd26262d36ea4a84f0..fc102e4f403e2fa42b05647e247db576720b64fa 100644 (file)
@@ -18,6 +18,7 @@
 #include "tests.h"
 #include "llvm.h"
 #include "debug.h"
+#include "parse-events.h"
 #define NR_ITERS       111
 #define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test"
 
index c3bec9d2c20101abab7e17d3324141524801e110..55774baffc2aecc2fb2f1eb5d61636c79aaa52e8 100644 (file)
@@ -8,6 +8,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/wait.h>
index 7b2b89f4b716abbf69e78f243bd79b23ec219897..c1c29e08e7fb26738390043ab945963eaa4e69df 100644 (file)
@@ -13,7 +13,9 @@
 
 #include "debug.h"
 #include "dso.h"
+#include "env.h"
 #include "parse-events.h"
+#include "trace-event.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "thread_map.h"
@@ -496,6 +498,10 @@ static void fs_something(void)
        }
 }
 
+#ifdef __s390x__
+#include "header.h" // for get_cpuid()
+#endif
+
 static const char *do_determine_event(bool excl_kernel)
 {
        const char *event = excl_kernel ? "cycles:u" : "cycles";
index 228d1618cf7d740406b8e191dda53f1e250fbc1a..d824a726906ce089f53499b4da316446b2eec4b7 100644 (file)
@@ -11,6 +11,7 @@
 #include "evsel.h"
 #include "util.h"
 #include "debug.h"
+#include "parse-events.h"
 #include "thread_map.h"
 #include "target.h"
 
index 4b68ec3a13fccbe566d26875c024afc6ace9954a..cac4290e233ac347980fbe4ed39db4a4fb905704 100644 (file)
@@ -1,8 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
 #include <perf/cpumap.h>
+#include <string.h>
 #include "evlist.h"
 #include "evsel.h"
+#include "header.h"
 #include "machine.h"
 #include "tool.h"
 #include "tests.h"
index c758798d37743b0ddadf0a52fbab7f0a5c00d3ad..9f0762d987fa4c45897d2d8e88fabd133fd9d22e 100644 (file)
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/types.h>
+#include <limits.h>
 #include <unistd.h>
 #include <sys/prctl.h>
 #include <perf/cpumap.h>
index bdf77bfe1b8036bf46981195db07d32db2c535bf..85e1d7337dc050c27e51fdbaeeb49f5bb23e3ccf 100644 (file)
@@ -3,6 +3,7 @@
 #include <inttypes.h>
 /* For the CLR_() macros */
 #include <pthread.h>
+#include <stdlib.h>
 #include <perf/cpumap.h>
 
 #include "debug.h"
index 49f52e4de41b2a01b3344a3e5d7fed2afdd11e5f..02ba696fb87f9376ddc23fe4772a7e62d363d0b1 100644 (file)
@@ -5,6 +5,7 @@
 #include <api/fs/fs.h>
 #include "tests.h"
 #include "debug.h"
+#include "pmu.h"
 #include "util.h"
 #include <dirent.h>
 #include <errno.h>
index 4bed15aee1a81baae0ddf539edf6d19bee70acac..1a60fa1219f55e26291fa751c14de4fcfaf401db 100644 (file)
@@ -2,6 +2,7 @@
 #include <sys/time.h>
 #include <sys/prctl.h>
 #include <errno.h>
+#include <limits.h>
 #include <time.h>
 #include <stdlib.h>
 #include <linux/zalloc.h>
index cf8857456056e9911b5455d9bfff8feec0e20aff..f7e54c16e5947d63867f50ced85b7ec0a5ca657d 100644 (file)
@@ -16,6 +16,7 @@
 #include "../../util/callchain.h"
 #include "../../util/evsel.h"
 #include "../../util/evlist.h"
+#include "../../util/header.h"
 #include "../../util/hist.h"
 #include "../../util/map.h"
 #include "../../util/symbol.h"
index db3954fea74c497f6b9f8c1ea1b5a022ea0d7595..f16a38fea45e3600163b6a11e7d64735cf169e60 100644 (file)
@@ -9,6 +9,8 @@
 #include "../util.h"
 #include "../../util/util.h"
 #include "../../perf.h"
+#include <stdlib.h>
+#include <string.h>
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 
index bf1d9f9ec035258175b68f5015baa017f4e9c0d7..586a21acc13d608ed8055877fab235fd71b9d0cc 100644 (file)
@@ -10,6 +10,7 @@
 #include "config.h"
 #include <linux/string.h>
 #include <linux/zalloc.h>
+#include <stdlib.h>
 
 #define SCRIPT_NAMELEN 128
 #define SCRIPT_MAX_NO  64
index bf90ce5b2cdfdd1c293c8b4d8228fce39a48cc37..3e533de7d852ca470d82bad17b19a3baca83eb57 100644 (file)
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <inttypes.h>
 #include <math.h>
+#include <stdlib.h>
+#include <string.h>
 #include <linux/compiler.h>
 
 #include "../util/callchain.h"
index 51ed67548b839c27092f77c4b7d53552c84b2a1b..832ca6cfbe305ccd7729c304a64d0221a4d3124f 100644 (file)
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
+#include <stdlib.h>
 #include <linux/string.h>
 
 #include "../../util/callchain.h"
index eb3c50de831d456ab721400f6bba4cf9253bc9b8..1748f528b6e9ac5a0e3bb41957153918fac317ec 100644 (file)
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <libgen.h>
+#include <stdlib.h>
 #include <bpf/bpf.h>
 #include <bpf/btf.h>
 #include <bpf/libbpf.h>
@@ -20,7 +21,9 @@
 #include "color.h"
 #include "config.h"
 #include "dso.h"
+#include "env.h"
 #include "map.h"
+#include "map_groups.h"
 #include "symbol.h"
 #include "srcline.h"
 #include "units.h"
index 10c707724035c1a69d2df936d027d58ce040c0e7..6f25224a3defe880497b57cd732b80d1c687d760 100644 (file)
@@ -2196,3 +2196,36 @@ int auxtrace_parse_filters(struct evlist *evlist)
 
        return 0;
 }
+
+int auxtrace__process_event(struct perf_session *session, union perf_event *event,
+                           struct perf_sample *sample, struct perf_tool *tool)
+{
+       if (!session->auxtrace)
+               return 0;
+
+       return session->auxtrace->process_event(session, event, sample, tool);
+}
+
+int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool)
+{
+       if (!session->auxtrace)
+               return 0;
+
+       return session->auxtrace->flush_events(session, tool);
+}
+
+void auxtrace__free_events(struct perf_session *session)
+{
+       if (!session->auxtrace)
+               return;
+
+       return session->auxtrace->free_events(session);
+}
+
+void auxtrace__free(struct perf_session *session)
+{
+       if (!session->auxtrace)
+               return;
+
+       return session->auxtrace->free(session);
+}
index c539e7b6ed5652200ea1d572bad869f33af3c518..37e70dc01436f4aa2fabc347510a59fe60b8e3cb 100644 (file)
@@ -18,7 +18,6 @@
 #include <asm/barrier.h>
 
 #include "event.h"
-#include "session.h"
 
 union perf_event;
 struct perf_session;
@@ -380,6 +379,8 @@ struct addr_filters {
        int                     cnt;
 };
 
+struct auxtrace_cache;
+
 #ifdef HAVE_AUXTRACE_SUPPORT
 
 /*
@@ -549,41 +550,11 @@ int addr_filters__parse_bare_filter(struct addr_filters *filts,
                                    const char *filter);
 int auxtrace_parse_filters(struct evlist *evlist);
 
-static inline int auxtrace__process_event(struct perf_session *session,
-                                         union perf_event *event,
-                                         struct perf_sample *sample,
-                                         struct perf_tool *tool)
-{
-       if (!session->auxtrace)
-               return 0;
-
-       return session->auxtrace->process_event(session, event, sample, tool);
-}
-
-static inline int auxtrace__flush_events(struct perf_session *session,
-                                        struct perf_tool *tool)
-{
-       if (!session->auxtrace)
-               return 0;
-
-       return session->auxtrace->flush_events(session, tool);
-}
-
-static inline void auxtrace__free_events(struct perf_session *session)
-{
-       if (!session->auxtrace)
-               return;
-
-       return session->auxtrace->free_events(session);
-}
-
-static inline void auxtrace__free(struct perf_session *session)
-{
-       if (!session->auxtrace)
-               return;
-
-       return session->auxtrace->free(session);
-}
+int auxtrace__process_event(struct perf_session *session, union perf_event *event,
+                           struct perf_sample *sample, struct perf_tool *tool);
+int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool);
+void auxtrace__free_events(struct perf_session *session);
+void auxtrace__free(struct perf_session *session);
 
 #define ITRACE_HELP \
 "                              i:                      synthesize instructions events\n"               \
index c1a57323e25da44c97583da8c301473da6674a51..37283e8653525da561a0d9d76913cb3e9f32a0c7 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/string.h>
 #include <linux/zalloc.h>
 #include <errno.h>
+#include <stdlib.h>
 #include "debug.h"
 #include "evlist.h"
 #include "bpf-loader.h"
index 96a931c6f728025f54c6fac9c731f863b02ac2fc..4881d4af338185e780009daa637ee36c2ecfa768 100644 (file)
@@ -8,6 +8,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
 
 int nr_cgroups;
 
index 7ebf9e31ae2275817effff80f6f5a0d6a31962de..0bc9c4d7fdc5d2239dc6c68dff690e9460d17a2e 100644 (file)
@@ -23,6 +23,7 @@
 #include "debug.h"
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <linux/string.h>
 #include <linux/zalloc.h>
index 30c2048ce67d64e6a317eee5545d3de25d2da224..0174ecf757d794ae05427f6e42de5e0a6ce1a6a2 100644 (file)
@@ -27,6 +27,7 @@
 #include "machine.h"
 #include "map.h"
 #include "perf.h"
+#include "session.h"
 #include "symbol.h"
 #include "tool.h"
 #include "thread.h"
index bc848fd095f4005ef016334c5b2ba292b747377a..650ecc2a63492a63b457e8d23e53c49d3f3cc20c 100644 (file)
@@ -8,9 +8,10 @@
 #define INCLUDE__UTIL_PERF_CS_ETM_H__
 
 #include "util/event.h"
-#include "util/session.h"
 #include <linux/bits.h>
 
+struct perf_session;
+
 /* Versionning header in case things need tro change in the future.  That way
  * decoding of old snapshot is still possible.
  */
index ece97209792d3f43de34d2db9662db216559d3b3..e11ddf86f2b39278500baa6c2d1cc9b130f860cb 100644 (file)
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <stdlib.h>
 #include <bpf/libbpf.h>
 #include "bpf-event.h"
 #include "compress.h"
+#include "env.h"
 #include "namespaces.h"
 #include "path.h"
 #include "map.h"
index b5d6d6ec9a9bea86458eccb8332635aeb22333c6..095924aa186b1d079bdee42b235d3545ade45fa0 100644 (file)
@@ -23,6 +23,7 @@
 #include <signal.h>
 #include <unistd.h>
 #include <sched.h>
+#include <stdlib.h>
 
 #include "parse-events.h"
 #include <subcmd/parse-options.h>
index b6b406a1678ffb179aa63fcf3f0d80923d2b31f3..85825384f9e887d2228af7930bfb78081587912b 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <stdlib.h>
 #include <perf/evsel.h>
 #include "asm/bug.h"
 #include "callchain.h"
index 003025465198d90fe12baf9da12cf9a653a5e432..6a77aefbe319e03c816c1c579e9e69d8b0ba386c 100644 (file)
@@ -3,9 +3,11 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <regex.h>
+#include <stdlib.h>
 #include "callchain.h"
 #include "debug.h"
 #include "dso.h"
+#include "env.h"
 #include "event.h"
 #include "evsel.h"
 #include "hist.h"
index 28477ff5114ee1196eff86f8e5e73b2f07779264..33c5b5495482cbeb80efe206cb2f9a8a9783f740 100644 (file)
 #include <inttypes.h>
 #include <asm/bug.h>
 #include <linux/zalloc.h>
+#include <stdlib.h>
+#include <string.h>
 #ifdef HAVE_LIBNUMA_SUPPORT
 #include <numaif.h>
 #endif
+#include "cpumap.h"
 #include "debug.h"
 #include "event.h"
 #include "mmap.h"
index 274ce389cd84891f0c97bf3184460e72a108912b..3857a49e8f967a4e56b88b556ffc24c73ae961dc 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/types.h>
 #include <linux/ring_buffer.h>
 #include <stdbool.h>
+#include <pthread.h> // for cpu_set_t
 #ifdef HAVE_AIO_SUPPORT
 #include <aio.h>
 #endif
index 9b350482c4036dfc39f84d13ecb50ccf3d20d2f5..07ca4535e6f740726a31693fbd3919547d53a0cb 100644 (file)
@@ -5,6 +5,7 @@
 #include <poll.h>
 #include <linux/err.h>
 #include <perf/cpumap.h>
+#include <traceevent/event-parse.h>
 #include "debug.h"
 #include "evlist.h"
 #include "callchain.h"
@@ -13,6 +14,7 @@
 #include "cpumap.h"
 #include "print_binary.h"
 #include "thread_map.h"
+#include "trace-event.h"
 #include "mmap.h"
 #include "util.h"
 #include "../perf-sys.h"
index ccad796bce5f349ac9be062f2a1ae33696cac576..286fe816c0f3bb856518d1d3de0a5a861dbbf94d 100644 (file)
@@ -5,6 +5,8 @@
 #include "cpumap.h"
 #include "parse-events.h"
 #include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
 #include <api/fs/fs.h>
 #include <subcmd/parse-options.h>
 #include <perf/cpumap.h>
index d311c81464e51a131b70197a238340f43911e4f8..0ddfa7b3e4f20d6b0c6cd8b81cef25faed681236 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "debug.h"
 #include "util.h"
-#include "auxtrace.h"
 #include "session.h"
 #include "evlist.h"
 #include "config.h"
index 32ade5a1b5531033c24914f9647937a868c2288c..b974a2c3a3c5d60ae6ac79ffa1bee19753647751 100644 (file)
@@ -2,6 +2,7 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <regex.h>
+#include <stdlib.h>
 #include <linux/mman.h>
 #include <linux/time64.h>
 #include "debug.h"
index 1461dac2322dd1d1d11fc58507da95631242f3d2..ed3b0ac2f7850fe53fa1678650830c260bec6c2a 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <linux/string.h>
index f4a1edcec7b29e0bd30e4f0e282355c4ff342b19..8f1ea27f976f232acc19af0597e9ce291edf9617 100644 (file)
@@ -2,9 +2,12 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <math.h>
+#include <string.h>
 #include "counts.h"
 #include "debug.h"
+#include "header.h"
 #include "stat.h"
+#include "session.h"
 #include "target.h"
 #include "evlist.h"
 #include "evsel.h"
index 7367433e767a45a396d6f41e178bdcee775732cd..f117d4f4821e0a26d441aec796c0ae6dcefcade4 100644 (file)
@@ -5,6 +5,7 @@
 #include "tool.h"
 #include "evswitch.h"
 #include "annotate.h"
+#include "ordered-events.h"
 #include "record.h"
 #include <linux/types.h>
 #include <stddef.h>