tools: handle renamed lookup_fast function in dcache tools
authorJerome Marchand <jmarchan@redhat.com>
Sat, 20 Mar 2021 13:33:59 +0000 (14:33 +0100)
committeryonghong-song <ys114321@gmail.com>
Sat, 20 Mar 2021 17:25:22 +0000 (10:25 -0700)
The lookup_fast function can be rename lookup_fast.constprop.x by gcc
constant propagation optimization and that breaks dcstat and
dcsnoop. Let's look for both name using a regular expression.

tools/dcsnoop.py
tools/dcstat.py

index 7c50152f38ab2c9aefd308ec55621fe48c13a026..819d4e66540d346e17196ebd151fd737c7518acf 100755 (executable)
@@ -129,7 +129,7 @@ if args.ebpf:
 # initialize BPF
 b = BPF(text=bpf_text)
 if args.all:
-    b.attach_kprobe(event="lookup_fast", fn_name="trace_fast")
+    b.attach_kprobe(event_re="^lookup_fast$|^lookup_fast.constprop.*.\d$", fn_name="trace_fast")
 
 mode_s = {
     0: 'M',
index 5ecddd1a7cf74b485d1d5bbc5de6be4035053940..bd0494cd1429a3395728e67ffbcae8620474245c 100755 (executable)
@@ -91,7 +91,7 @@ void count_lookup(struct pt_regs *ctx) {
 
 # load BPF program
 b = BPF(text=bpf_text)
-b.attach_kprobe(event="lookup_fast", fn_name="count_fast")
+b.attach_kprobe(event_re="^lookup_fast$|^lookup_fast.constprop.*.\d$", fn_name="count_fast")
 b.attach_kretprobe(event="d_lookup", fn_name="count_lookup")
 
 # stat column labels and indexes