mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
46f5913e6f4ca70b1ecf3f367754b69df00a8471
In many scenarios, the upper range of an aggregation histogram may be empty (ex. max histogram bins is for 1000ms but highest observed RTT was 100 ms, leaving 900 trailing empty bins). As trailing empty bins contain no useful information, simply truncate the histograms to the highest non-empty bin. The truncation of histograms has two benefits. 1. It avoids unnecessary processing of empty bins when internally calculating statics from the histograms. This should not have any impact on the output. 2. It reduces the size of the histogram in the JSON output format. This can potentially save a lot of space in instances where most maximum observed RTT for a prefix during an aggregation interval is significantly lower than the highest histogram bin. Removing trailing empty bins (unlike non-trailing ones) does not require encoding any additional information (like the number of removed bins or the index of the remaining ones). It can also never make the histogram take up more space. Thus there are no obvious drawbacks with "compressing" the histograms in this manner. In the future it may be relevant to implement other ways to compress the histograms, which may be more efficient for certain distributions (ex. very sparse histograms). However as this method of removing trailing empty bins is both simple and without drawbacks, so it makes sense to make the default behavior for now. 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).
Languages
C
93.6%
Shell
4.7%
Makefile
1.6%