On 8/6/19 4:38 PM, Daniel Xu wrote: > It's useful to know kprobe's nmissed and nhit stats. For example with > tracing tools, it's important to know when events may have been lost. > There is currently no way to get that information from the perf API. > This patch adds a new ioctl that lets users query this information. Probably worthwhile to further elaborate the use case. The debugfs does have a way to count kprobe nmissed and nhit through /sys/kernel/debug/tracing/kprobe_profile. But there is no uapi to count the nmissed and nhit for FD-based kprobe interface. bpf program itself might be able to count nhit, but still no uapi to get the nmissed counters. > > Daniel Xu (3): > tracing/kprobe: Add PERF_EVENT_IOC_QUERY_KPROBE ioctl > libbpf: Add helper to extract perf fd from bpf_link > tracing/kprobe: Add self test for PERF_EVENT_IOC_QUERY_KPROBE > > include/linux/trace_events.h | 6 +++ > include/uapi/linux/perf_event.h | 23 ++++++++++ > kernel/events/core.c | 11 +++++ > kernel/trace/trace_kprobe.c | 25 +++++++++++ > tools/include/uapi/linux/perf_event.h | 23 ++++++++++ > tools/lib/bpf/libbpf.c | 13 ++++++ > tools/lib/bpf/libbpf.h | 1 + > tools/lib/bpf/libbpf.map | 5 +++ > .../selftests/bpf/prog_tests/attach_probe.c | 43 +++++++++++++++++++ > 9 files changed, 150 insertions(+) >