Hi all, I wanted to start a small thread where I shared progress towards a fun project I’ve been working on: flametui! Hope that this is appropriate for this forum. The idea behind this project is to measure a simple flamegraph using eBPF, resolve the symbols, and then display it in the terminal.
I have my own profiling backend that uses eBPF to measure the stack traces from userspace and the kernel on all CPUs at a user defined rate (in hertz). We parse the resolve the symbols from the stacktraces partially while measuring, and partially after the fact. Optionally, a user may skip my (janky) profiler and just supply their own recording they made with e.g. perf. We show the flamegraph in the tui, and allow the user to explore it! Here’s a little gif of how that looks, where userspace and kernel traces are colored differently (based on your terminals colorscheme, or atleast on my machine):

We use libbpf for working with eBPF and the wonderful libvaxis for the purpose of plotting.
The reason I made this program is to solve a simple pain point I was having at work: I wanted to measure a flamegraph on an embedded platform, but couldn’t be bothered with perf-ing, manually copying the big data file over, then parsing it with the collection of perl scripts to view the svg. Too many steps, too much effort. This project can be cross compiled to e.g. aarch64, simply deployed, and presto!
That being said, I am aware that making a profiler is probably a fools errand, as perf is always going to better than whatever I make. That being said, for informal profiling and educational purposes, this has been great fun and satisfying to see come to life.
You can find flametui here: GitHub - nielsdekoeijer/flametui
Currently, it is in v0.0.1-alpha, but I’ve been having so much fun working on it that I was keen to share it anyway. Feel free to try it out! It’s janky so apologies in advance if you run into any struggles.
Future goals are as follows:
- Plotting AND measuring at the same time: I want to see the Flamegraph grow as I measure. Moreover, I am keen to explore what I will dub “time-varying” flamegraphs. Essentially, I am curious to experiment with flamegraphs that show a “window” in time. This way they can be used as a live-monitoring tool. I can easily see how we can get into a sort of measurement uncertainty principal though, as this would likely be quite expensive to do. I’m sure it will look cool nevertheless

- De-jankyify the codebase: Currently, its a codebase only a mother can love. I think I can improve it greatly by refactoring for better readability and optimizing. As of alpha, it more or less works but there are bugs. I also really want to improve the error handling. Currently, if we can’t quite find a symbol, we just print “unmapped”. That’s not very helpful.
- Add better interactions: I want to add arrow keys and vim keybindings (naturally). Plus, I’d like the user to be able to read all the availible controls by pressing “?”.
Anyway, thanks for taking the time to check out my project ![]()