aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.h
diff options
context:
space:
mode:
authorJon Doron <jond@wiz.io>2023-02-07 10:19:16 +0200
committerAndrii Nakryiko <andrii@kernel.org>2023-02-08 15:27:39 -0800
commitab8684b8cecf711cc9e47c1cbb1a8f4b549f8893 (patch)
treea49c0d20fc9050717c695e2408303d54cb6502ec /tools/lib/bpf/libbpf.h
parentsfc: move xdp_features configuration in efx_pci_probe_post_io() (diff)
downloadlinux-ab8684b8cecf711cc9e47c1cbb1a8f4b549f8893.tar.xz
linux-ab8684b8cecf711cc9e47c1cbb1a8f4b549f8893.zip
libbpf: Add sample_period to creation options
Add option to set when the perf buffer should wake up, by default the perf buffer becomes signaled for every event that is being pushed to it. In case of a high throughput of events it will be more efficient to wake up only once you have X events ready to be read. So your application can wakeup once and drain the entire perf buffer. Signed-off-by: Jon Doron <jond@wiz.io> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20230207081916.3398417-1-arilou@gmail.com
Diffstat (limited to 'tools/lib/bpf/libbpf.h')
-rw-r--r--tools/lib/bpf/libbpf.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index b18581277eb2..2efd80f6f7b9 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -1247,8 +1247,10 @@ typedef void (*perf_buffer_lost_fn)(void *ctx, int cpu, __u64 cnt);
/* common use perf buffer options */
struct perf_buffer_opts {
size_t sz;
+ __u32 sample_period;
+ size_t :0;
};
-#define perf_buffer_opts__last_field sz
+#define perf_buffer_opts__last_field sample_period
/**
* @brief **perf_buffer__new()** creates BPF perfbuf manager for a specified