Skip to content

Commit

Permalink
修改BCC_sar
Browse files Browse the repository at this point in the history
  • Loading branch information
albertxu216 committed Sep 19, 2024
1 parent e81328a commit 3dd669b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,17 @@ __always_inline static void on_sys_exit(u64 time) {
}

// 进入用户态
int exit_to_user_mode_prepare() {
// Step1: 记录user开始时间,和当前的in_user状态
struct task_struct *ts = (struct task_struct *)bpf_get_current_task();
if (ts->pid != TARGET_PID) return 0;
u64 time = bpf_ktime_get_ns();
// int exit_to_user_mode_prepare() {
// // Step1: 记录user开始时间,和当前的in_user状态
// struct task_struct *ts = (struct task_struct *)bpf_get_current_task();
// if (ts->pid != TARGET_PID) return 0;
// u64 time = bpf_ktime_get_ns();

on_user_enter(time);
on_sys_exit(time);
// on_user_enter(time);
// on_sys_exit(time);

return 0;
}
// return 0;
// }

// 获取进程切换数
int trace_sched_switch(struct cswch_args *info) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def attach_probe(pid: int):
bpf.attach_tracepoint(tp="irq:irq_handler_exit", fn_name="trace_irq_handler_exit")
bpf.attach_tracepoint(tp="raw_syscalls:sys_enter", fn_name="trace_sys_enter")
# bpf.attach_tracepoint(tp="raw_syscalls:sys_exit", fn_name="trace_sys_exit")
bpf.attach_kprobe(event="exit_to_user_mode_prepare",fn_name="exit_to_user_mode_prepare")
# bpf.attach_kprobe(event="exit_to_user_mode_prepare",fn_name="exit_to_user_mode_prepare")
return bpf

def perpro_main(args, pid: int):
Expand Down

0 comments on commit 3dd669b

Please sign in to comment.