move helper annotations to helpers module

This commit is contained in:
2025-10-02 01:55:32 +05:30
parent 23f3cbcea7
commit 1a66887f48
12 changed files with 22 additions and 11 deletions

View File

@ -60,12 +60,13 @@ pip install pythonbpf pylibbpf
```python
import time
from pythonbpf import bpf, map, section, bpfglobal, BPF
from pythonbpf.helpers import pid
from pythonbpf.helper import pid
from pythonbpf.maps import HashMap
from pylibbpf import *
from ctypes import c_void_p, c_int64, c_uint64, c_int32
import matplotlib.pyplot as plt
# This program attaches an eBPF tracepoint to sys_enter_clone,
# counts per-PID clone syscalls, stores them in a hash map,
# and then plots the distribution as a histogram using matplotlib.
@ -76,6 +77,7 @@ import matplotlib.pyplot as plt
def hist() -> HashMap:
return HashMap(key=c_int32, value=c_uint64, max_entries=4096)
@bpf
@section("tracepoint/syscalls/sys_enter_clone")
def hello(ctx: c_void_p) -> c_int64: