summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/bpf-filter.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2023-03-14 16:42:31 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-03-15 11:08:35 -0300
commit27c6f2455b29f27c8daf209ec8bdf0ac2c567b74 (patch)
tree71fd2e97d118f4868283d30c72c2c4ec39318273 /tools/perf/util/bpf-filter.c
parentd180aa56b50dd243dec89b24d23e0a59c3f0c0eb (diff)
downloadlinux-stable-27c6f2455b29f27c8daf209ec8bdf0ac2c567b74.tar.gz
linux-stable-27c6f2455b29f27c8daf209ec8bdf0ac2c567b74.tar.bz2
linux-stable-27c6f2455b29f27c8daf209ec8bdf0ac2c567b74.zip
perf record: Record dropped sample count
When it uses bpf filters, event might drop some samples. It'd be nice if it can report how many samples it lost. As LOST_SAMPLES event can carry the similar information, let's use it for bpf filters. To indicate it's from BPF filters, add a new misc flag for that and do not display cpu load warnings. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Hao Luo <haoluo@google.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: James Clark <james.clark@arm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Song Liu <song@kernel.org> Cc: Stephane Eranian <eranian@google.com> Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/bpf-filter.c')
-rw-r--r--tools/perf/util/bpf-filter.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c
index f20e1bc03778..7bd6f2e41513 100644
--- a/tools/perf/util/bpf-filter.c
+++ b/tools/perf/util/bpf-filter.c
@@ -69,6 +69,13 @@ int perf_bpf_filter__destroy(struct evsel *evsel)
return 0;
}
+u64 perf_bpf_filter__lost_count(struct evsel *evsel)
+{
+ struct sample_filter_bpf *skel = evsel->bpf_skel;
+
+ return skel ? skel->bss->dropped : 0;
+}
+
struct perf_bpf_filter_expr *perf_bpf_filter_expr__new(unsigned long sample_flags,
enum perf_bpf_filter_op op,
unsigned long val)