Skip to content

Commit 9568b3d

Browse files
committed
add cpu profiling
1 parent 8fa3be8 commit 9568b3d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ebpf/main.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,16 @@ func run() {
111111
doProfilingCpu := false
112112
trafficUtils.InitVar("AKTO_DEBUG_CPU_PROFILING", &doProfilingCpu)
113113

114-
if doProfilingCpu {
115-
ticker := time.NewTicker(time.Minute) // Create a ticker to trigger every minute
116-
defer ticker.Stop()
114+
go func() {
115+
if doProfilingCpu {
116+
ticker := time.NewTicker(time.Minute) // Create a ticker to trigger every minute
117+
defer ticker.Stop()
117118

118-
for range ticker.C {
119-
captureCpuProfile() // Capture memory profile every time the ticker ticks
119+
for range ticker.C {
120+
captureCpuProfile() // Capture memory profile every time the ticker ticks
121+
}
120122
}
121-
}
123+
}()
122124

123125
trafficMetrics.InitTrafficMaps()
124126
trafficMetrics.StartMetricsTicker()

0 commit comments

Comments
 (0)