initial commit; liz rice stuff

This commit is contained in:
tamsin woo 2024-07-02 11:18:42 -07:00
commit 071172fe9f
3 changed files with 28 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# learning eBPF

View File

@ -0,0 +1,3 @@
# A Beginners Guide to eBPF Programming - Liz Rice - Full Keynote
https://www.youtube.com/watch?v=lrSExTfS-iQ

View File

@ -0,0 +1,24 @@
#!/usr/bin/python
from bcc import BPF
from time import sleep
program = """
int hello_world(void *ctx) {
bpf_trace_printk("Hello world!\\n");
return 0;
}
"""
b = BPF(text=program{)
clones = b.get_syscall_fnname("clone")
b.attach_kprobe()
while True
sleep(2)
s = ""
if let(b["clones"].items()):
for k,v in b["clones"].items():
s += "ID {}: {}\t".format(k.value, v.value)
print(s)
else:
print("No entries yet")