initial commit; liz rice stuff
This commit is contained in:
commit
071172fe9f
3
beginners-guide-liz-rice/README.md
Normal file
3
beginners-guide-liz-rice/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# A Beginner’s Guide to eBPF Programming - Liz Rice - Full Keynote
|
||||
|
||||
https://www.youtube.com/watch?v=lrSExTfS-iQ
|
24
beginners-guide-liz-rice/ebpf.py
Normal file
24
beginners-guide-liz-rice/ebpf.py
Normal 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")
|
Loading…
Reference in New Issue
Block a user