diff options
author | Namhyung Kim <namhyung@kernel.org> | 2025-06-04 10:48:35 -0700 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2025-06-09 11:18:17 -0700 |
commit | 189a977e4dc011b05aa1fee044d1a98cf904341b (patch) | |
tree | c41aece187514f9f123a4d68b02181638952e9f4 /tools/perf/util/scripting-engines/trace-event-python.c | |
parent | 19272b37aa4f83ca52bdf9c16d5d81bdd1354494 (diff) |
perf bpf-filter: Improve error messages
The BPF filter needs libbpf/BPF-skeleton support and root privilege.
Add error messages to help users understand the problem easily.
When it's not build with BPF support (make BUILD_BPF_SKEL=0).
$ sudo perf record -e cycles --filter "pid != 0" true
Error: BPF filter is requested but perf is not built with BPF.
Please make sure to build with libbpf and BPF skeleton.
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
--filter <filter>
event filter
When it supports BPF but runs without root or CAP_BPF. Note that it
also checks pinned BPF filters.
$ perf record -e cycles --filter "pid != 0" -o /dev/null true
Error: BPF filter only works for users with the CAP_BPF capability!
Please run 'perf record --setup-filter pin' as root first.
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
--filter <filter>
event filter
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250604174835.1852481-1-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
0 files changed, 0 insertions, 0 deletions