Files
python-bpf/BCC-Examples
..
2025-11-27 12:45:48 +05:30
2025-12-08 16:23:44 +05:30
2025-11-11 21:08:06 +05:30
2025-10-20 15:10:12 +05:30
2025-10-21 03:56:04 +05:30

BCC examples ported to PythonBPF

This folder contains examples of BCC tutorial examples that have been ported to use PythonBPF.

Requirements

  • install pythonbpf and pylibbpf using pip.
  • You will also need matplotlib for vfsreadlat.py example.
  • You will also need rich for vfsreadlat_rich.py example.
  • You will also need plotly and dash for vfsreadlat_plotly.py example.
  • All of these are added to requirements.txt file. You can install them using the following command:
    pip install -r requirements.txt
    

Usage

  • You'll need root privileges to run these examples. If you are using a virtualenv, use the following command to run the scripts:
    sudo <path_to_virtualenv>/bin/python3 <script_name>.py
    
  • For the disksnoop and container-monitor examples, you need to generate the vmlinux.py file first. Follow the instructions in the main README to generate the vmlinux.py file.
  • For vfsreadlat_plotly.py, run the following command to start the Dash server:
    sudo <path_to_virtualenv>/bin/python3 vfsreadlat_plotly/bpf_program.py
    
    Then open your web browser and navigate to the given URL.
  • For container-monitor, you need to first copy the vmlinux.py to container-monitor/ directory. Then run the following command to run the example:
      cp vmlinux.py container-monitor/
      sudo <path_to_virtualenv>/bin/python3 container-monitor/container_monitor.py