bpfmemapie icon indicating copy to clipboard operation
bpfmemapie copied to clipboard

A tool to render a pie chart of memory usage (bytes_memlock) of BPF maps on the system 🥧

bpfmemapie 🥧

A tool to render a pie chart of memory usage (bytes_memlock) of BPF maps on the system. Sorry for the naming, it's for memapie, memapie and memapie, so BPF mem map pie.

Installation

go install github.com/mtardy/bpfmemapie@latest

Usage

It needs bpftool to be installed and to execute as root for bpftool to list the maps and their info.

sudo bpfmemapie

After opening http://localhost:8080 (you can change the port with --port), you should see something like this:

output of bpfmemapie: a pie chart with the maps memory

The pie chart is interactive, you can click on the legend to hide/show entries or hover on the pie to see the tooltip. You can also change how the "others" category using the threshold URL query, for example http://localhost:8080/?threshold=1.

Alternative

If you don't need the pie chart part, you can just use bpftool and jq to see the same statistics:

sudo bpftool map -j | jq ' group_by(.name) | map({name: .[0].name, total_bytes_memlock: map(.bytes_memlock | tonumber) | add, maps: length}) | sort_by(.total_bytes_memlock)'