Skip to content

Commit 808db27

Browse files
committed
Add instructions to run examples in README
1 parent 99fc5d7 commit 808db27

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

BCC-Examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This folder contains examples of BCC tutorial examples that have been ported to
1313
```bash
1414
sudo <path_to_virtualenv>/bin/python3 <script_name>.py
1515
```
16+
- For the disksnoop and container-monitor examples, you need to generate the vmlinux.py file first.
1617
- For vfsreadlat_plotly.py, run the following command to start the Dash server:
1718
```bash
1819
sudo <path_to_virtualenv>/bin/python3 vfsreadlat_plotly/bpf_program.py

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,34 @@ Python-BPF is an LLVM IR generator for eBPF programs written in Python. It uses
4141
---
4242

4343
## Try It Out!
44-
Run
44+
45+
#### First, generate the vmlinux.py file for your kernel:
46+
- Install the required dependencies:
47+
- On Ubuntu:
48+
```bash
49+
sudo apt-get install bpftool clang
50+
pip install ctypeslib2
51+
```
52+
- Generate the `vmlinux.py` using:
53+
```bash
54+
sudo tools/vmlinux-gen.py
55+
```
56+
- Copy this file to `BCC-Examples/`
57+
58+
#### Next, install requirements for BCC-Examples:
59+
- These requirements are only required for the python notebooks, vfsreadlat and container-monitor examples.
60+
```bash
61+
pip install -r BCC-Examples/requirements.txt
62+
```
63+
- Now, follow the instructions in the [BCC-Examples/README.md](https://github.com/pythonbpf/Python-BPF/blob/master/BCC-Examples/README.md) to run the examples.
64+
65+
66+
#### To spin up jupyter notebook examples:
67+
- Run and follow the instructions on screen
4568
```bash
4669
curl -s https://raw.githubusercontent.com/pythonbpf/Python-BPF/refs/heads/master/tools/setup.sh | sudo bash
4770
```
71+
- Check the jupyter server on the web browser and run the notebooks in the `BCC-Examples/` folder.
4872

4973
## Installation
5074

0 commit comments

Comments
 (0)