Skip to content

Commit e51c350

Browse files
authored
Update README.md with feature documentation
1 parent 6817817 commit e51c350

File tree

1 file changed

+144
-9
lines changed

1 file changed

+144
-9
lines changed

README.md

Lines changed: 144 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,25 @@ nix-env -iA nixpkgs.bpftop
4545

4646
## Features
4747

48-
- Displays a list of all running eBPF programs on the host, including the ID, type, and name
49-
- Shows the period and total average runtime for each eBPF program.
50-
- Calculates the events per second and estimated CPU utilization for each eBPF program
51-
- Provides a graphical view of the average runtime, events per second, and estimated CPU utilization over a 10-second time period
52-
- Dynamically updates the list every second
53-
- Enables the statistics-gathering function only while it is active
48+
- **Real-time monitoring**: Displays a list of all running eBPF programs with ID, type, and name
49+
- **Performance metrics**: Shows period and total average runtime, events per second, and estimated CPU utilization
50+
- **Interactive navigation**: Navigate using arrow keys (↑/↓) or vim-style keys (j/k)
51+
- **Time-series graphs**: Press Enter on a program to view graphical representations of performance metrics over time
52+
- **Program filtering**: Press 'f' to filter programs by name or type
53+
- **Column sorting**: Press 's' to sort by different columns (ascending/descending)
54+
- **Process information**: Displays process names and PIDs that reference each eBPF program
55+
- **Scrollbar navigation**: Automatically shows scrollbar when the program list exceeds terminal height
56+
- **Customizable refresh rate**: Set update interval with `-d/--delay` option (1-3600 seconds)
57+
- **Backward compatibility**: Supports Linux kernels from version 5.8+ (older kernels via procfs)
58+
- **Minimal overhead**: Enables statistics gathering only while active, automatically disables on exit
59+
- **Logging integration**: Logs to systemd journal when available
5460

5561
## Prerequisites
5662

5763
- `bpftop` requires `sudo` privileges to run.
64+
- Linux kernel version 5.8 or later (older kernels supported via procfs fallback)
5865
- The binary is dynamically linked to `libz` and `libelf`, so these libraries must be present on the systems where you intend to run `bpftop`.
66+
- For logging functionality: systemd/journald (optional, will gracefully fallback if not available)
5967

6068
## Usage
6169

@@ -65,6 +73,60 @@ Run the following command to start `bpftop` on your host:
6573
sudo ./bpftop
6674
```
6775

76+
### Command-line Options
77+
78+
- `-d, --delay <SECONDS>`: Set refresh interval (1-3600 seconds, default: 1)
79+
- `-h, --help`: Show help information
80+
- `-V, --version`: Show version information
81+
82+
Examples:
83+
```bash
84+
# Start with default 1-second refresh
85+
sudo ./bpftop
86+
87+
# Update every 2 seconds
88+
sudo ./bpftop -d 2
89+
90+
# Update every 5 seconds
91+
sudo ./bpftop --delay 5
92+
```
93+
94+
### Interactive Controls
95+
96+
Once running, use these keyboard shortcuts:
97+
98+
**Navigation:**
99+
- `↑/↓` or `k/j`: Navigate up/down through the program list
100+
- `Enter`: Switch to graphical view for the selected program
101+
- `q`: Quit the application
102+
103+
**Features:**
104+
- `f`: Filter programs by name or type
105+
- `s`: Sort programs by different columns (use arrow keys to select column and direction)
106+
107+
**In graph view:**
108+
- `Enter` or `q`: Return to the main program list
109+
110+
### Viewing Process Information
111+
112+
When you select a program, `bpftop` displays additional information including:
113+
- Process names and PIDs that reference the selected eBPF program
114+
- Detailed performance metrics and graphs
115+
116+
### Logging
117+
118+
`bpftop` logs operational information to the systemd journal when available. You can view these logs using:
119+
120+
```bash
121+
journalctl _COMM=bpftop
122+
```
123+
124+
Common log entries include:
125+
- Application startup and shutdown
126+
- Kernel version information
127+
- BPF statistics enablement status
128+
- Error conditions and debugging information
129+
68130
## Relate links
69131

70132
* [Announcement blog post](https://netflixtechblog.com/announcing-bpftop-streamlining-ebpf-performance-optimization-6a727c1ae2e5)
@@ -77,6 +139,79 @@ sudo ./bpftop
77139

78140
## Building from source
79141

80-
1. Install and setup [cross](https://github.com/cross-rs/cross)
81-
2. Run `cross build --release` for x86_64
82-
3. Run `cross build --target=aarch64-unknown-linux-gnu --release` for Arm64
142+
### Prerequisites
143+
Install required dependencies:
144+
```bash
145+
# Ubuntu/Debian
146+
sudo apt-get install -y zlib1g-dev libelf-dev clang libbpf-dev
147+
148+
# Fedora/RHEL
149+
sudo dnf install -y zlib-devel elfutils-libelf-devel clang libbpf-devel
150+
```
151+
152+
### Build Instructions
153+
154+
**For native builds:**
155+
```bash
156+
# Development build
157+
cargo build
158+
159+
# Release build
160+
cargo build --release
161+
```
162+
163+
**For cross-compilation:**
164+
1. Install and setup [cross](https://github.com/cross-rs/cross):
165+
```bash
166+
cargo install cross --git https://github.com/cross-rs/cross
167+
```
168+
169+
2. Build for target architectures:
170+
```bash
171+
# x86_64
172+
cross build --release --target x86_64-unknown-linux-gnu
173+
174+
# ARM64
175+
cross build --release --target aarch64-unknown-linux-gnu
176+
```
177+
178+
Note: Cross-compilation builds may take 15+ minutes on first run due to Docker image building.
179+
180+
## Troubleshooting
181+
182+
### Common Issues
183+
184+
**"This program must be run as root"**
185+
- Ensure you're running with `sudo` privileges. eBPF statistics collection requires root access.
186+
187+
**No programs displayed**
188+
- This is normal if no eBPF programs are currently loaded on your system
189+
- Try loading an eBPF program (e.g., using `bpftrace`, `bcc-tools`, or other eBPF utilities) to see them in bpftop
190+
191+
**Terminal display issues**
192+
- Ensure your terminal supports ANSI colors and has sufficient size
193+
- Minimum recommended terminal size: 80x24 characters
194+
195+
**Missing libraries error**
196+
- Install the required system dependencies: `libz` and `libelf`
197+
- On Ubuntu/Debian: `sudo apt-get install zlib1g-dev libelf-dev`
198+
199+
### Logging and Debugging
200+
201+
View application logs:
202+
```bash
203+
# View all bpftop logs
204+
journalctl _COMM=bpftop
205+
206+
# Follow logs in real-time
207+
journalctl _COMM=bpftop -f
208+
209+
# View logs from last boot
210+
journalctl _COMM=bpftop -b
211+
```
212+
213+
The logs include information about:
214+
- Application startup and shutdown
215+
- Kernel compatibility checks
216+
- BPF statistics enablement method used
217+
- Any errors or warnings encountered

0 commit comments

Comments
 (0)