From aeb00b1aeab6dadd72c24f93bea51a46e109c2ba Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 22 Aug 2019 15:40:29 -0300 Subject: perf record: Move record_opts and other record decls out of perf.h And into a separate util/record.h, to better isolate things and make sure that those who use record_opts and the other moved declarations are explicitly including the necessary header. Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lkml.kernel.org/n/tip-31q8mei1qkh74qvkl9nwidfq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/perf/builtin-script.c') diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 9b93ddeaeafa..ee05621d3bd6 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include "builtin.h" -#include "perf.h" #include "util/cache.h" #include "util/counts.h" #include "util/debug.h" @@ -51,6 +50,7 @@ #include #include #include +#include "util/record.h" #include -- cgit From 97b9d866a66cf9884cea623cde3300073815873d Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 22 Aug 2019 17:10:08 -0300 Subject: perf srcline: Add missing srcline.h header to files needing its defs When srcline was introduced it wrongly added the include to util/sort.h, even with that header not needing the definitions it provides, fix it by adding it to the places that need it as a pre patch to remove srcline.h from sort.h. Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lkml.kernel.org/n/tip-shuebppedtye8hrgxk15qe3x@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-diff.c | 2 ++ tools/perf/builtin-report.c | 1 + tools/perf/builtin-script.c | 1 + tools/perf/util/annotate.c | 2 ++ tools/perf/util/machine.c | 2 ++ tools/perf/util/sort.c | 1 + 6 files changed, 9 insertions(+) (limited to 'tools/perf/builtin-script.c') diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index e91c0d798181..51c37e53b3d8 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -15,6 +15,7 @@ #include "util/session.h" #include "util/tool.h" #include "util/sort.h" +#include "util/srcline.h" #include "util/symbol.h" #include "util/data.h" #include "util/config.h" @@ -22,6 +23,7 @@ #include "util/annotate.h" #include "util/map.h" #include +#include #include #include diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 79dfb1139f94..318b0b95c14c 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -28,6 +28,7 @@ #include "util/evswitch.h" #include "util/header.h" #include "util/session.h" +#include "util/srcline.h" #include "util/tool.h" #include diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index ee05621d3bd6..6f389b33fbe5 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -11,6 +11,7 @@ #include "util/session.h" #include "util/tool.h" #include "util/map.h" +#include "util/srcline.h" #include "util/symbol.h" #include "util/thread.h" #include "util/trace-event.h" diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index e0518dc4c4d2..3bd1691f0be7 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -22,6 +22,7 @@ #include "cache.h" #include "map.h" #include "symbol.h" +#include "srcline.h" #include "units.h" #include "debug.h" #include "annotate.h" @@ -37,6 +38,7 @@ #include #include #include +#include /* FIXME: For the HE_COLORSET */ #include "ui/browser.h" diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index f7c1a7e6c4ba..47430afd3c2d 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -10,11 +10,13 @@ #include "hist.h" #include "machine.h" #include "map.h" +#include "srcline.h" #include "symbol.h" #include "sort.h" #include "strlist.h" #include "target.h" #include "thread.h" +#include "util.h" #include "vdso.h" #include #include diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 904ff4b2f57f..c522bdde3f71 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -13,6 +13,7 @@ #include "thread.h" #include "evsel.h" #include "evlist.h" +#include "srcline.h" #include "strlist.h" #include "strbuf.h" #include -- cgit From 3f604b5f61dbff80725392c99827d6617f7bb180 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 26 Aug 2019 19:28:13 -0300 Subject: perf tool: Rename perf_tool::bpf_event to bpf No need for that _event suffix, do just like all the other meta event handlers and suppress that suffix. Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Cc: Song Liu Link: https://lkml.kernel.org/n/tip-03spzxtqafbabbbmnm7y4xfx@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-script.c | 4 ++-- tools/perf/util/bpf-event.c | 11 +++++------ tools/perf/util/bpf-event.h | 10 +++++----- tools/perf/util/event.c | 14 +++++++------- tools/perf/util/event.h | 10 +++++----- tools/perf/util/machine.c | 2 +- tools/perf/util/session.c | 6 +++--- tools/perf/util/tool.h | 2 +- 8 files changed, 29 insertions(+), 30 deletions(-) (limited to 'tools/perf/builtin-script.c') diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 6f389b33fbe5..51e7e6d0eee6 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -2492,8 +2492,8 @@ static int __cmd_script(struct perf_script *script) script->tool.finished_round = process_finished_round_event; } if (script->show_bpf_events) { - script->tool.ksymbol = process_bpf_events; - script->tool.bpf_event = process_bpf_events; + script->tool.ksymbol = process_bpf_events; + script->tool.bpf = process_bpf_events; } if (perf_script__setup_per_event_dump(script)) { diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index 28fa2b1ce66e..2d6d500c9af7 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -64,12 +64,11 @@ static int machine__process_bpf_event_load(struct machine *machine, return 0; } -int machine__process_bpf_event(struct machine *machine __maybe_unused, - union perf_event *event, - struct perf_sample *sample __maybe_unused) +int machine__process_bpf(struct machine *machine, union perf_event *event, + struct perf_sample *sample) { if (dump_trace) - perf_event__fprintf_bpf_event(event, stdout); + perf_event__fprintf_bpf(event, stdout); switch (event->bpf.type) { case PERF_BPF_EVENT_PROG_LOAD: @@ -83,7 +82,7 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused, */ break; default: - pr_debug("unexpected bpf_event type of %d\n", event->bpf.type); + pr_debug("unexpected bpf event type of %d\n", event->bpf.type); break; } return 0; @@ -410,7 +409,7 @@ static int bpf_event__sb_cb(union perf_event *event, void *data) */ break; default: - pr_debug("unexpected bpf_event type of %d\n", event->bpf.type); + pr_debug("unexpected bpf event type of %d\n", event->bpf.type); break; } diff --git a/tools/perf/util/bpf-event.h b/tools/perf/util/bpf-event.h index 26ab9239f986..417b78835ea0 100644 --- a/tools/perf/util/bpf-event.h +++ b/tools/perf/util/bpf-event.h @@ -30,8 +30,8 @@ struct btf_node { }; #ifdef HAVE_LIBBPF_SUPPORT -int machine__process_bpf_event(struct machine *machine, union perf_event *event, - struct perf_sample *sample); +int machine__process_bpf(struct machine *machine, union perf_event *event, + struct perf_sample *sample); int perf_event__synthesize_bpf_events(struct perf_session *session, perf_event__handler_t process, @@ -43,9 +43,9 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, struct perf_env *env, FILE *fp); #else -static inline int machine__process_bpf_event(struct machine *machine __maybe_unused, - union perf_event *event __maybe_unused, - struct perf_sample *sample __maybe_unused) +static inline int machine__process_bpf(struct machine *machine __maybe_unused, + union perf_event *event __maybe_unused, + struct perf_sample *sample __maybe_unused) { return 0; } diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 17304df44fc2..33616ea62a47 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1343,12 +1343,12 @@ int perf_event__process_ksymbol(struct perf_tool *tool __maybe_unused, return machine__process_ksymbol(machine, event, sample); } -int perf_event__process_bpf_event(struct perf_tool *tool __maybe_unused, - union perf_event *event, - struct perf_sample *sample __maybe_unused, - struct machine *machine) +int perf_event__process_bpf(struct perf_tool *tool __maybe_unused, + union perf_event *event, + struct perf_sample *sample, + struct machine *machine) { - return machine__process_bpf_event(machine, event, sample); + return machine__process_bpf(machine, event, sample); } size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp) @@ -1491,7 +1491,7 @@ size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp) event->ksymbol.flags, event->ksymbol.name); } -size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp) +size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp) { return fprintf(fp, " type %u, flags %u, id %u\n", event->bpf.type, event->bpf.flags, event->bpf.id); @@ -1536,7 +1536,7 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp) ret += perf_event__fprintf_ksymbol(event, fp); break; case PERF_RECORD_BPF_EVENT: - ret += perf_event__fprintf_bpf_event(event, fp); + ret += perf_event__fprintf_bpf(event, fp); break; default: ret += fprintf(fp, "\n"); diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 7251e2eee441..429a3fe52d6c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -683,10 +683,10 @@ int perf_event__process_ksymbol(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_bpf_event(struct perf_tool *tool, - union perf_event *event, - struct perf_sample *sample, - struct machine *machine); +int perf_event__process_bpf(struct perf_tool *tool, + union perf_event *event, + struct perf_sample *sample, + struct machine *machine); int perf_tool__process_synth_event(struct perf_tool *tool, union perf_event *event, struct machine *machine, @@ -751,7 +751,7 @@ size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp); size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp); size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp); size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp); -size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp); +size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp); size_t perf_event__fprintf(union perf_event *event, FILE *fp); int kallsyms__get_function_start(const char *kallsyms_filename, diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 86b7fd24b1e1..93483f1764d3 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1922,7 +1922,7 @@ int machine__process_event(struct machine *machine, union perf_event *event, case PERF_RECORD_KSYMBOL: ret = machine__process_ksymbol(machine, event, sample); break; case PERF_RECORD_BPF_EVENT: - ret = machine__process_bpf_event(machine, event, sample); break; + ret = machine__process_bpf(machine, event, sample); break; default: ret = -1; break; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 4bfec9db36d6..5786e9c807c5 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -473,8 +473,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool) tool->context_switch = perf_event__process_switch; if (tool->ksymbol == NULL) tool->ksymbol = perf_event__process_ksymbol; - if (tool->bpf_event == NULL) - tool->bpf_event = perf_event__process_bpf_event; + if (tool->bpf == NULL) + tool->bpf = perf_event__process_bpf; if (tool->read == NULL) tool->read = process_event_sample_stub; if (tool->throttle == NULL) @@ -1452,7 +1452,7 @@ static int machines__deliver_event(struct machines *machines, case PERF_RECORD_KSYMBOL: return tool->ksymbol(tool, event, sample, machine); case PERF_RECORD_BPF_EVENT: - return tool->bpf_event(tool, event, sample, machine); + return tool->bpf(tool, event, sample, machine); default: ++evlist->stats.nr_unknown_events; return -1; diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h index 7f95dd1d6883..2abbf668b8de 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h @@ -56,7 +56,7 @@ struct perf_tool { throttle, unthrottle, ksymbol, - bpf_event; + bpf; event_attr_op attr; event_attr_op event_update; -- cgit