Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mtardy/bpfmemapie

A tool to render a pie chart of memory usage (bytes_memlock) of BPF maps on the system 🥧
https://github.com/mtardy/bpfmemapie

bpf ebpf maps memory pie

Last synced: 24 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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 **mem**apie, me**map**ie and mema**pie**,
so BPF mem map pie.

## Installation

```shell
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.

```shell
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:

```shell
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)'
```