You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by li...@apache.org on 2023/04/04 03:27:03 UTC

[skywalking-rover] branch main updated: replace the way to get tgid and pid (#87)

This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/main by this push:
     new 606d8eb  replace the way to get tgid and pid (#87)
606d8eb is described below

commit 606d8eb36fb6f613b098a62c1249eb9707cd4896
Author: Jelipo <ha...@daocloud.io>
AuthorDate: Tue Apr 4 11:26:57 2023 +0800

    replace the way to get tgid and pid (#87)
---
 bpf/profiling/offcpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bpf/profiling/offcpu.c b/bpf/profiling/offcpu.c
index c0af649..512a153 100644
--- a/bpf/profiling/offcpu.c
+++ b/bpf/profiling/offcpu.c
@@ -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;
     }