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

wusheng 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 4c0cb84  Make off CPU profiling E2E more stable (#186)
4c0cb84 is described below

commit 4c0cb8429a96f190ea30eac1807008d523c749c3
Author: mrproliu <[email protected]>
AuthorDate: Wed Mar 19 22:09:20 2025 +0800

    Make off CPU profiling E2E more stable (#186)
---
 pkg/profiling/task/offcpu/runner.go | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/pkg/profiling/task/offcpu/runner.go 
b/pkg/profiling/task/offcpu/runner.go
index 218e3c6..7ce2e0c 100644
--- a/pkg/profiling/task/offcpu/runner.go
+++ b/pkg/profiling/task/offcpu/runner.go
@@ -120,12 +120,22 @@ func (r *Runner) Run(ctx context.Context, notify 
base.ProfilingRunningSuccessNot
 
        symbols := r.findMatchesSymbol()
        linker := btf.NewLinker()
-       switchers := make(map[string]*ebpf.Program)
+       linkedCount := 0
        for _, symbol := range symbols {
+               switchers := make(map[string]*ebpf.Program)
                switchers[symbol] = objs.DoFinishTaskSwitch
+               err = linker.AddLinkOrError(link.Kprobe, switchers)
+               if err != nil {
+                       log.Warnf("link to finish task swtich(%s) failure: %v", 
symbol, err)
+                       continue
+               }
+               linkedCount++
+       }
+
+       if linkedCount == 0 {
+               return fmt.Errorf("link to finish task swtich failure: no 
symbol linked")
        }
 
-       linker.AddLink(link.Kprobe, switchers)
        if err := linker.HasError(); err != nil {
                return fmt.Errorf("link to finish task swtich failure: %v", err)
        }
@@ -145,6 +155,7 @@ func (r *Runner) findMatchesSymbol() []string {
                log.Warnf("found symbol error: %v", err)
                return []string{defaultKernelSymbol}
        }
+       log.Debugf("total found %d off cpu symbols: %v", len(res), res)
        return res
 }
 

Reply via email to