From 808db2722db3dbb0fa240c8609e8af179cdd6138 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Sun, 30 Nov 2025 05:26:41 +0530 Subject: [PATCH] Add instructions to run examples in README --- BCC-Examples/README.md | 1 + README.md | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/BCC-Examples/README.md b/BCC-Examples/README.md index 09bb759..6f7ebde 100644 --- a/BCC-Examples/README.md +++ b/BCC-Examples/README.md @@ -13,6 +13,7 @@ This folder contains examples of BCC tutorial examples that have been ported to ```bash sudo /bin/python3 .py ``` +- For the disksnoop and container-monitor examples, you need to generate the vmlinux.py file first. - For vfsreadlat_plotly.py, run the following command to start the Dash server: ```bash sudo /bin/python3 vfsreadlat_plotly/bpf_program.py diff --git a/README.md b/README.md index 7a43208..c2c71ec 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,34 @@ Python-BPF is an LLVM IR generator for eBPF programs written in Python. It uses --- ## Try It Out! -Run + +#### First, generate the vmlinux.py file for your kernel: +- Install the required dependencies: +- On Ubuntu: +```bash +sudo apt-get install bpftool clang +pip install ctypeslib2 +``` +- Generate the `vmlinux.py` using: +```bash +sudo tools/vmlinux-gen.py +``` +- Copy this file to `BCC-Examples/` + +#### Next, install requirements for BCC-Examples: +- These requirements are only required for the python notebooks, vfsreadlat and container-monitor examples. +```bash +pip install -r BCC-Examples/requirements.txt +``` +- 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. + + +#### To spin up jupyter notebook examples: +- Run and follow the instructions on screen ```bash curl -s https://raw.githubusercontent.com/pythonbpf/Python-BPF/refs/heads/master/tools/setup.sh | sudo bash ``` +- Check the jupyter server on the web browser and run the notebooks in the `BCC-Examples/` folder. ## Installation