diff --git a/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.bpf.c b/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.bpf.c index 4ae7d22f6..b7888b1c6 100644 --- a/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.bpf.c +++ b/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.bpf.c @@ -334,8 +334,8 @@ int BPF_KPROBE(query__end){ return __handle_mysql_end(ctx); } -SEC("uprobe/call") -int BPF_KPROBE(query__start_redis) { +SEC("uprobe/processCommand") +int BPF_KPROBE(query__start_redis_process) { return __handle_redis_start(ctx); } SEC("uretprobe/call") diff --git a/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.c b/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.c index b23e6c03e..43e95dc2f 100644 --- a/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.c +++ b/eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.c @@ -563,10 +563,10 @@ static void set_disable_load(struct netwatcher_bpf *skel) { mysql_info ? true : false); bpf_program__set_autoload(skel->progs.query__end, mysql_info ? true : false); - bpf_program__set_autoload(skel->progs.query__start_redis, - redis_info ? true : false); bpf_program__set_autoload(skel->progs.query__end_redis, redis_info ? true : false); + bpf_program__set_autoload(skel->progs.query__start_redis_process, + redis_info ? true : false); } static void print_header(enum MonitorMode mode) { @@ -1190,8 +1190,12 @@ int attach_uprobe_mysql(struct netwatcher_bpf *skel) { return 0; } int attach_uprobe_redis(struct netwatcher_bpf *skel) { - ATTACH_UPROBE_CHECKED(skel, call, query__start_redis); - ATTACH_UPROBE_CHECKED(skel, call, query__end_redis); + ATTACH_UPROBE_CHECKED( + skel, call, + query__end_redis); + ATTACH_UPROBE_CHECKED( + skel, processCommand, + query__start_redis_process); return 0; } int main(int argc, char **argv) { diff --git a/eBPF_Supermarket/Network_Subsystem/net_watcher/redis.bpf.h b/eBPF_Supermarket/Network_Subsystem/net_watcher/redis.bpf.h index ae4cf559a..c3e319ce3 100644 --- a/eBPF_Supermarket/Network_Subsystem/net_watcher/redis.bpf.h +++ b/eBPF_Supermarket/Network_Subsystem/net_watcher/redis.bpf.h @@ -17,7 +17,7 @@ #include "common.bpf.h" #include "redis_helper.bpf.h" -#define MAXEPOLL 4 +#define MAXEPOLL 5 static __always_inline int __handle_redis_start(struct pt_regs *ctx) { struct client *cli = (struct client *)PT_REGS_PARM1(ctx); struct redis_query start={}; @@ -34,7 +34,6 @@ static __always_inline int __handle_redis_start(struct pt_regs *ctx) { bpf_probe_read(&arg1, sizeof(arg1), &arg0[i]); bpf_probe_read(&ptr, sizeof(ptr),&arg1->ptr); bpf_probe_read_str(&start.redis[i], sizeof(start.redis[i]), ptr); - //bpf_printk("%s",start.redis[i]); } pid_t pid = bpf_get_current_pid_tgid() >> 32; u64 start_time = bpf_ktime_get_ns() / 1000; @@ -64,7 +63,6 @@ static __always_inline int __handle_redis_end(struct pt_regs *ctx) { } bpf_probe_read_str(&message->redis, sizeof(start->redis), start->redis); message->duratime = end_time - start->begin_time; - bpf_printk("%llu - %llu = %llu",end_time,start->begin_time,message->duratime); bpf_ringbuf_submit(message, 0); return 0; } \ No newline at end of file