Revise python tutorial lesson 16 to make sure tutorial text and code match.
diff --git a/examples/tracing/task_switch.py b/examples/tracing/task_switch.py
index 161edfb..43a4f3f 100755
--- a/examples/tracing/task_switch.py
+++ b/examples/tracing/task_switch.py
@@ -5,29 +5,7 @@
from bcc import BPF
from time import sleep
-b = BPF(text="""
-#include <uapi/linux/ptrace.h>
-#include <linux/sched.h>
-
-struct key_t {
- u32 prev_pid;
- u32 curr_pid;
-};
-// map_type, key_type, leaf_type, table_name, num_entry
-BPF_HASH(stats, struct key_t, u64, 1024);
-int count_sched(struct pt_regs *ctx, struct task_struct *prev) {
- struct key_t key = {};
- u64 zero = 0, *val;
-
- key.curr_pid = bpf_get_current_pid_tgid();
- key.prev_pid = prev->pid;
-
- // could also use `stats.increment(key);`
- val = stats.lookup_or_init(&key, &zero);
- (*val)++;
- return 0;
-}
-""")
+b = BPF(src_file="task_switch.c")
b.attach_kprobe(event="finish_task_switch", fn_name="count_sched")
# generate many schedule events