mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
3a7b15ab3e7cba03d8f682d13b83d3471d28d75f
Add an option -a or --aggregate to provide an aggregate report of RTT samples every X seconds. This is currently mutually exclusive with the normal per-RTT sample reports. The aggregated stats are never reset, and thus contain all RTTs since the start of tracing. The next commit will change this to reset the stats after every report, so that each report only contain the RTTs since the last report. The RTTs are aggregated and reported per IP-prefix, where the user can modify the size of the prefixes used for IPv4 and IPv6 using the --aggregate-subnet-v4/v6 flags. In this intital implementation for aggregating RTTs, the minimum and maximum RTT are tracked and all RTTs are added to a histogram. It uses a predetermined number of bins of equal width (set to 1000 bins, each 1 ms wide), see RTT_AGG_NR_BINS and RTT_AGG_BIN_WIDTH in pping.h. In the future this could be changed to use more sophisticated histograms that better capture a wide variety of RTTs. Implement the periodic reporting of RTTs by using a timerfd (configured to the user-provided interval) and add it to the main epoll-loop. To minimize overhead from the hash lookups, use separate maps for IPv4 and IPv6, so that for IPv4 traffic the hashmap key is only 4 bytes (instead of 16). Furthermore, limit the maximum IPv6 prefix size to 64 so that the IPv6 map can use a 8 byte key. This limits the maximum prefix size for IPv6 to /64. Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
Practical BPF examples
This git repository contains a diverse set of practical BPF examples that solve (or demonstrate) a specific use-case using BPF.
It is meant to ease doing rapid prototyping and development, writing C-code BPF programs using libbpf. The goal is to make it easier for developers to get started coding.
Many developers struggle to get a working BPF build environment. The repo enviroment makes it easy to build/compile BPF programs by doing the necessary libbpf setup transparently and detect missing compile dependencies (via the configure script). It is a declared goal to make BPF programming more consumable by detecting and reporting issues (when possible).
Description
Languages
C
93.6%
Shell
4.7%
Makefile
1.6%