Commit ef4e1fc7 authored by Brendan Gregg's avatar Brendan Gregg

cleaner get_table calls

parent 68abbeca
...@@ -40,7 +40,7 @@ if len(argv) > 1: ...@@ -40,7 +40,7 @@ if len(argv) > 1:
# load BPF program # load BPF program
b = BPF(src_file = "bitehist.c") b = BPF(src_file = "bitehist.c")
BPF.attach_kprobe(b.load_func("do_request", BPF.KPROBE), "blk_start_request") BPF.attach_kprobe(b.load_func("do_request", BPF.KPROBE), "blk_start_request")
dist = b.get_table("dist", c_int, c_ulonglong) dist = b.get_table("dist")
dist_max = 64 dist_max = 64
# header # header
......
...@@ -41,7 +41,7 @@ if len(argv) > 1: ...@@ -41,7 +41,7 @@ if len(argv) > 1:
b = BPF(src_file = "vfsreadlat.c") b = BPF(src_file = "vfsreadlat.c")
BPF.attach_kprobe(b.load_func("do_entry", BPF.KPROBE), "vfs_read") BPF.attach_kprobe(b.load_func("do_entry", BPF.KPROBE), "vfs_read")
BPF.attach_kretprobe(b.load_func("do_return", BPF.KPROBE), "vfs_read") BPF.attach_kretprobe(b.load_func("do_return", BPF.KPROBE), "vfs_read")
dist = b.get_table("dist", c_int, c_ulonglong) dist = b.get_table("dist")
dist_max = 64 dist_max = 64
# header # header
......
...@@ -19,7 +19,7 @@ from time import sleep, strftime ...@@ -19,7 +19,7 @@ from time import sleep, strftime
# load BPF program # load BPF program
b = BPF(src_file = "pidpersec.c") b = BPF(src_file = "pidpersec.c")
BPF.attach_kprobe(b.load_func("do_count", BPF.KPROBE), "sched_fork") BPF.attach_kprobe(b.load_func("do_count", BPF.KPROBE), "sched_fork")
stats = b.get_table("stats", c_int, c_ulonglong) stats = b.get_table("stats")
# stat indexes # stat indexes
S_COUNT = 1 S_COUNT = 1
......
...@@ -42,7 +42,7 @@ BPF.attach_kprobe(b.load_func("do_write", BPF.KPROBE), "vfs_write") ...@@ -42,7 +42,7 @@ BPF.attach_kprobe(b.load_func("do_write", BPF.KPROBE), "vfs_write")
BPF.attach_kprobe(b.load_func("do_fsync", BPF.KPROBE), "vfs_fsync") BPF.attach_kprobe(b.load_func("do_fsync", BPF.KPROBE), "vfs_fsync")
BPF.attach_kprobe(b.load_func("do_open", BPF.KPROBE), "vfs_open") BPF.attach_kprobe(b.load_func("do_open", BPF.KPROBE), "vfs_open")
BPF.attach_kprobe(b.load_func("do_create", BPF.KPROBE), "vfs_create") BPF.attach_kprobe(b.load_func("do_create", BPF.KPROBE), "vfs_create")
stats = b.get_table("stats", c_int, c_ulonglong) stats = b.get_table("stats")
# stat column labels and indexes # stat column labels and indexes
stat_types = { stat_types = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment