Skip to content

Commit

Permalink
replace the way to get tgid and pid (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
jelipo authored Apr 4, 2023
1 parent 76e46d5 commit 606d8eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bpf/profiling/offcpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ int do_finish_task_switch(struct pt_regs *ctx) {

// if current process have record start time in the map
// means the monitored process switch to the on-cpu
struct task_struct *current = (void *)bpf_get_current_task();
pid = _(current->pid);
tgid = _(current->tgid);
__u64 pid_tgid = bpf_get_current_pid_tgid();
pid = pid_tgid;
tgid = pid_tgid >> 32;
if (tgid != monitor_pid) {
return 0;
}
Expand Down

0 comments on commit 606d8eb

Please sign in to comment.