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 ade721c  Added debug level log into cpu profiling (#188)
ade721c is described below

commit ade721cddcd5d32fed322ebfdf3de28107317cdd
Author: mrproliu <[email protected]>
AuthorDate: Thu Apr 10 21:29:06 2025 +0800

    Added debug level log into cpu profiling (#188)
---
 pkg/profiling/task/base/runner.go   | 2 ++
 pkg/profiling/task/manager.go       | 1 +
 pkg/profiling/task/offcpu/runner.go | 3 +++
 pkg/profiling/task/oncpu/runner.go  | 5 +++++
 4 files changed, 11 insertions(+)

diff --git a/pkg/profiling/task/base/runner.go 
b/pkg/profiling/task/base/runner.go
index a874893..f13bfe5 100644
--- a/pkg/profiling/task/base/runner.go
+++ b/pkg/profiling/task/base/runner.go
@@ -55,8 +55,10 @@ func (r *Runner) GenerateProfilingData(profilingInfo 
*profiling.Info, stackID ui
        }
        symbols := profilingInfo.FindSymbols(symbolArray, MissingSymbol)
        if len(symbols) == 0 {
+               log.Debugf("there no symbols found for %v stack: %d", 
stackType, stackID)
                return nil
        }
+       log.Debugf("total found symbols: %d for %v stack: %d", len(symbols), 
stackType, stackID)
        return &v3.EBPFProfilingStackMetadata{
                StackType:    stackType,
                StackId:      int32(stackID),
diff --git a/pkg/profiling/task/manager.go b/pkg/profiling/task/manager.go
index b1bb612..9046c1f 100644
--- a/pkg/profiling/task/manager.go
+++ b/pkg/profiling/task/manager.go
@@ -343,6 +343,7 @@ func (m *Manager) FlushProfilingData() error {
        // cleanup the stopped after flush profiling data to make sure all the 
profiling data been sent
        defer m.checkStoppedTaskAndRemoved()
        if len(m.tasks) == 0 {
+               log.Debugf("no profiling task need to flush")
                return nil
        }
 
diff --git a/pkg/profiling/task/offcpu/runner.go 
b/pkg/profiling/task/offcpu/runner.go
index 7ce2e0c..2221fdd 100644
--- a/pkg/profiling/task/offcpu/runner.go
+++ b/pkg/profiling/task/offcpu/runner.go
@@ -196,6 +196,7 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, 
error) {
        stacks := r.bpf.Stacks
        result := make([]*v3.EBPFProfilingData, 0)
        stackSymbols := make([]uint64, 100)
+       count := 0
        for iterate.Next(&stack, &counter) {
                metadatas := make([]*v3.EBPFProfilingStackMetadata, 0)
                // kernel stack
@@ -223,6 +224,7 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, 
error) {
                }
                r.previousStacks[stack] = counter
                if switchCount <= 0 {
+                       log.Debugf("the dump count is 0 for stack: %v", stack)
                        continue
                }
 
@@ -236,6 +238,7 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, 
error) {
                        },
                })
        }
+       log.Debugf("total found stacks: %d", count)
 
        if r.flushDataNotify != nil {
                r.flushDataNotify()
diff --git a/pkg/profiling/task/oncpu/runner.go 
b/pkg/profiling/task/oncpu/runner.go
index 07c60c8..616a031 100644
--- a/pkg/profiling/task/oncpu/runner.go
+++ b/pkg/profiling/task/oncpu/runner.go
@@ -135,6 +135,7 @@ func (r *Runner) Run(ctx context.Context, notify 
base.ProfilingRunningSuccessNot
        if err != nil {
                return err
        }
+       log.Debugf("success running on cpu profiling, perf event fds: %v", 
perfEvents)
 
        // notify start success
        notify()
@@ -218,6 +219,7 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, 
error) {
        stacks := r.bpf.Stacks
        result := make([]*v3.EBPFProfilingData, 0)
        stackSymbols := make([]uint64, 100)
+       count := 0
        for iterate.Next(&stack, &counter) {
                metadatas := make([]*v3.EBPFProfilingStackMetadata, 0)
                // kernel stack
@@ -244,6 +246,7 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, 
error) {
                }
                r.stackCounter[stack] = counter
                if dumpCount <= 0 {
+                       log.Debugf("the dump count is 0 for stack: %v", stack)
                        continue
                }
 
@@ -255,7 +258,9 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, 
error) {
                                },
                        },
                })
+               count++
        }
+       log.Debugf("total found stacks: %d", count)
 
        // close the flush data notify if exists
        if r.flushDataNotify != nil {

Reply via email to