Commit 9421054e authored by Brendan Gregg's avatar Brendan Gregg

tidier example

parent 057b0780
......@@ -21,7 +21,7 @@ b = BPF(src_file = "pidpersec.c")
b.attach_kprobe(event="sched_fork", fn_name="do_count")
# stat indexes
S_COUNT = 1
S_COUNT = c_int(1)
# header
print("Tracing... Ctrl-C to end.")
......@@ -35,5 +35,5 @@ while (1):
pass; exit()
print("%s: PIDs/sec: %d" % (strftime("%H:%M:%S"),
(b["stats"][c_int(S_COUNT)].value - last)))
last = b["stats"][c_int(S_COUNT)].value
(b["stats"][S_COUNT].value - last)))
last = b["stats"][S_COUNT].value
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