添加测试功能:TCP 写入服务端、单次发送客户端、压力测试客户端、kprobe Hello World基础验证
All checks were successful
CI / lint-and-build (push) Successful in 2m35s
CD / deploy (push) Successful in 1m6s

This commit is contained in:
2026-06-15 20:23:14 +08:00
parent 83ac6179dc
commit 81a8573e51
5 changed files with 151 additions and 1 deletions

22
hello.py Normal file
View File

@@ -0,0 +1,22 @@
"""基础验证eBPF kprobe Hello World 程序(实验大纲 基础验证部分)"""
from bcc import BPF
prog = """
int hello(void *ctx) {
bpf_trace_printk("Hello, World!\\n");
return 0;
}
"""
b = BPF(text=prog)
execve_function = b.get_syscall_fnname("execve")
b.attach_kprobe(event=execve_function, fn_name="hello")
print("%-18s %-16s %-6s %s" % ("TIME(s)", "COMM", "PID", "MESSAGE"))
while True:
try:
task, pid, cpu, flags, ts, msg = b.trace_fields()
except ValueError:
continue
print("%-18.9f %-16s %-6d %s" % (ts, task, pid, msg))