perf auxtrace: Uninline functions that touch perf_session

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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent fa0d9846
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/zalloc.h> #include <linux/zalloc.h>
#include <sys/types.h> #include <sys/types.h>
#include <regex.h> #include <regex.h>
#include <stdlib.h>
struct arm_annotate { struct arm_annotate {
regex_t call_insn, regex_t call_insn,
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "../../util/pmu.h" #include "../../util/pmu.h"
#include "../../util/cs-etm.h" #include "../../util/cs-etm.h"
#include "../../util/util.h" #include "../../util/util.h"
#include "../../util/session.h"
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <sys/types.h> #include <sys/types.h>
#include <regex.h> #include <regex.h>
#include <stdlib.h>
struct arm64_annotate { struct arm64_annotate {
regex_t call_insn, regex_t call_insn,
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h> #include <poll.h>
#include <linux/capability.h> #include <linux/capability.h>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "record.h" #include "record.h"
#include "tests.h" #include "tests.h"
#include "debug.h" #include "debug.h"
#include "parse-events.h"
#include <errno.h> #include <errno.h>
#include <linux/string.h> #include <linux/string.h>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "tests.h" #include "tests.h"
#include "llvm.h" #include "llvm.h"
#include "debug.h" #include "debug.h"
#include "parse-events.h"
#define NR_ITERS 111 #define NR_ITERS 111
#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" #define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test"
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <sys/wait.h> #include <sys/wait.h>
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
#include "debug.h" #include "debug.h"
#include "dso.h" #include "dso.h"
#include "env.h"
#include "parse-events.h" #include "parse-events.h"
#include "trace-event.h"
#include "evlist.h" #include "evlist.h"
#include "evsel.h" #include "evsel.h"
#include "thread_map.h" #include "thread_map.h"
...@@ -496,6 +498,10 @@ static void fs_something(void) ...@@ -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) static const char *do_determine_event(bool excl_kernel)
{ {
const char *event = excl_kernel ? "cycles:u" : "cycles"; const char *event = excl_kernel ? "cycles:u" : "cycles";
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "evsel.h" #include "evsel.h"
#include "util.h" #include "util.h"
#include "debug.h" #include "debug.h"
#include "parse-events.h"
#include "thread_map.h" #include "thread_map.h"
#include "target.h" #include "target.h"
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/compiler.h> #include <linux/compiler.h>
#include <perf/cpumap.h> #include <perf/cpumap.h>
#include <string.h>
#include "evlist.h" #include "evlist.h"
#include "evsel.h" #include "evsel.h"
#include "header.h"
#include "machine.h" #include "machine.h"
#include "tool.h" #include "tool.h"
#include "tests.h" #include "tests.h"
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/types.h> #include <linux/types.h>
#include <limits.h>
#include <unistd.h> #include <unistd.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include <perf/cpumap.h> #include <perf/cpumap.h>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <inttypes.h> #include <inttypes.h>
/* For the CLR_() macros */ /* For the CLR_() macros */
#include <pthread.h> #include <pthread.h>
#include <stdlib.h>
#include <perf/cpumap.h> #include <perf/cpumap.h>
#include "debug.h" #include "debug.h"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <api/fs/fs.h> #include <api/fs/fs.h>
#include "tests.h" #include "tests.h"
#include "debug.h" #include "debug.h"
#include "pmu.h"
#include "util.h" #include "util.h"
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include <linux/zalloc.h> #include <linux/zalloc.h>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "../../util/callchain.h" #include "../../util/callchain.h"
#include "../../util/evsel.h" #include "../../util/evsel.h"
#include "../../util/evlist.h" #include "../../util/evlist.h"
#include "../../util/header.h"
#include "../../util/hist.h" #include "../../util/hist.h"
#include "../../util/map.h" #include "../../util/map.h"
#include "../../util/symbol.h" #include "../../util/symbol.h"
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "../util.h" #include "../util.h"
#include "../../util/util.h" #include "../../util/util.h"
#include "../../perf.h" #include "../../perf.h"
#include <stdlib.h>
#include <string.h>
#include <linux/time64.h> #include <linux/time64.h>
#include <linux/zalloc.h> #include <linux/zalloc.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "config.h" #include "config.h"
#include <linux/string.h> #include <linux/string.h>
#include <linux/zalloc.h> #include <linux/zalloc.h>
#include <stdlib.h>
#define SCRIPT_NAMELEN 128 #define SCRIPT_NAMELEN 128
#define SCRIPT_MAX_NO 64 #define SCRIPT_MAX_NO 64
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <inttypes.h> #include <inttypes.h>
#include <math.h> #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include "../util/callchain.h" #include "../util/callchain.h"
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <linux/string.h> #include <linux/string.h>
#include "../../util/callchain.h" #include "../../util/callchain.h"
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <libgen.h> #include <libgen.h>
#include <stdlib.h>
#include <bpf/bpf.h> #include <bpf/bpf.h>
#include <bpf/btf.h> #include <bpf/btf.h>
#include <bpf/libbpf.h> #include <bpf/libbpf.h>
...@@ -20,7 +21,9 @@ ...@@ -20,7 +21,9 @@
#include "color.h" #include "color.h"
#include "config.h" #include "config.h"
#include "dso.h" #include "dso.h"
#include "env.h"
#include "map.h" #include "map.h"
#include "map_groups.h"
#include "symbol.h" #include "symbol.h"
#include "srcline.h" #include "srcline.h"
#include "units.h" #include "units.h"
......
...@@ -2196,3 +2196,36 @@ int auxtrace_parse_filters(struct evlist *evlist) ...@@ -2196,3 +2196,36 @@ int auxtrace_parse_filters(struct evlist *evlist)
return 0; 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);
}
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <asm/barrier.h> #include <asm/barrier.h>
#include "event.h" #include "event.h"
#include "session.h"
union perf_event; union perf_event;
struct perf_session; struct perf_session;
...@@ -380,6 +379,8 @@ struct addr_filters { ...@@ -380,6 +379,8 @@ struct addr_filters {
int cnt; int cnt;
}; };
struct auxtrace_cache;
#ifdef HAVE_AUXTRACE_SUPPORT #ifdef HAVE_AUXTRACE_SUPPORT
/* /*
...@@ -549,41 +550,11 @@ int addr_filters__parse_bare_filter(struct addr_filters *filts, ...@@ -549,41 +550,11 @@ int addr_filters__parse_bare_filter(struct addr_filters *filts,
const char *filter); const char *filter);
int auxtrace_parse_filters(struct evlist *evlist); int auxtrace_parse_filters(struct evlist *evlist);
static inline int auxtrace__process_event(struct perf_session *session, int auxtrace__process_event(struct perf_session *session, union perf_event *event,
union perf_event *event, struct perf_sample *sample, struct perf_tool *tool);
struct perf_sample *sample, int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool);
struct perf_tool *tool) void auxtrace__free_events(struct perf_session *session);
{ void auxtrace__free(struct perf_session *session);
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);
}
#define ITRACE_HELP \ #define ITRACE_HELP \
" i: synthesize instructions events\n" \ " i: synthesize instructions events\n" \
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/zalloc.h> #include <linux/zalloc.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h>
#include "debug.h" #include "debug.h"
#include "evlist.h" #include "evlist.h"
#include "bpf-loader.h" #include "bpf-loader.h"
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h>
#include <string.h>
int nr_cgroups; int nr_cgroups;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "debug.h" #include "debug.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/zalloc.h> #include <linux/zalloc.h>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "machine.h" #include "machine.h"
#include "map.h" #include "map.h"
#include "perf.h" #include "perf.h"
#include "session.h"
#include "symbol.h" #include "symbol.h"
#include "tool.h" #include "tool.h"
#include "thread.h" #include "thread.h"
......
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
#define INCLUDE__UTIL_PERF_CS_ETM_H__ #define INCLUDE__UTIL_PERF_CS_ETM_H__
#include "util/event.h" #include "util/event.h"
#include "util/session.h"
#include <linux/bits.h> #include <linux/bits.h>
struct perf_session;
/* Versionning header in case things need tro change in the future. That way /* Versionning header in case things need tro change in the future. That way
* decoding of old snapshot is still possible. * decoding of old snapshot is still possible.
*/ */
......
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h>
#include <bpf/libbpf.h> #include <bpf/libbpf.h>
#include "bpf-event.h" #include "bpf-event.h"
#include "compress.h" #include "compress.h"
#include "env.h"
#include "namespaces.h" #include "namespaces.h"
#include "path.h" #include "path.h"
#include "map.h" #include "map.h"
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <sched.h> #include <sched.h>
#include <stdlib.h>
#include "parse-events.h" #include "parse-events.h"
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <stdlib.h>
#include <perf/evsel.h> #include <perf/evsel.h>
#include "asm/bug.h" #include "asm/bug.h"
#include "callchain.h" #include "callchain.h"
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <regex.h> #include <regex.h>
#include <stdlib.h>
#include "callchain.h" #include "callchain.h"
#include "debug.h" #include "debug.h"
#include "dso.h" #include "dso.h"
#include "env.h"
#include "event.h" #include "event.h"
#include "evsel.h" #include "evsel.h"
#include "hist.h" #include "hist.h"
......
...@@ -10,9 +10,12 @@ ...@@ -10,9 +10,12 @@
#include <inttypes.h> #include <inttypes.h>
#include <asm/bug.h> #include <asm/bug.h>
#include <linux/zalloc.h> #include <linux/zalloc.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIBNUMA_SUPPORT #ifdef HAVE_LIBNUMA_SUPPORT
#include <numaif.h> #include <numaif.h>
#endif #endif
#include "cpumap.h"
#include "debug.h" #include "debug.h"
#include "event.h" #include "event.h"
#include "mmap.h" #include "mmap.h"
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/ring_buffer.h> #include <linux/ring_buffer.h>
#include <stdbool.h> #include <stdbool.h>
#include <pthread.h> // for cpu_set_t
#ifdef HAVE_AIO_SUPPORT #ifdef HAVE_AIO_SUPPORT
#include <aio.h> #include <aio.h>
#endif #endif
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <poll.h> #include <poll.h>
#include <linux/err.h> #include <linux/err.h>
#include <perf/cpumap.h> #include <perf/cpumap.h>
#include <traceevent/event-parse.h>
#include "debug.h" #include "debug.h"
#include "evlist.h" #include "evlist.h"
#include "callchain.h" #include "callchain.h"
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
#include "cpumap.h" #include "cpumap.h"
#include "print_binary.h" #include "print_binary.h"
#include "thread_map.h" #include "thread_map.h"
#include "trace-event.h"
#include "mmap.h" #include "mmap.h"
#include "util.h" #include "util.h"
#include "../perf-sys.h" #include "../perf-sys.h"
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "cpumap.h" #include "cpumap.h"
#include "parse-events.h" #include "parse-events.h"
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <api/fs/fs.h> #include <api/fs/fs.h>
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
#include <perf/cpumap.h> #include <perf/cpumap.h>
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "debug.h" #include "debug.h"
#include "util.h" #include "util.h"
#include "auxtrace.h"
#include "session.h" #include "session.h"
#include "evlist.h" #include "evlist.h"
#include "config.h" #include "config.h"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <regex.h> #include <regex.h>
#include <stdlib.h>
#include <linux/mman.h> #include <linux/mman.h>
#include <linux/time64.h> #include <linux/time64.h>
#include "debug.h" #include "debug.h"
......
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <inttypes.h> #include <inttypes.h>
#include <linux/string.h> #include <linux/string.h>
......
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <math.h> #include <math.h>
#include <string.h>
#include "counts.h" #include "counts.h"
#include "debug.h" #include "debug.h"
#include "header.h"
#include "stat.h" #include "stat.h"
#include "session.h"
#include "target.h" #include "target.h"
#include "evlist.h" #include "evlist.h"
#include "evsel.h" #include "evsel.h"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "tool.h" #include "tool.h"
#include "evswitch.h" #include "evswitch.h"
#include "annotate.h" #include "annotate.h"
#include "ordered-events.h"
#include "record.h" #include "record.h"
#include <linux/types.h> #include <linux/types.h>
#include <stddef.h> #include <stddef.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment