Skip to content

Commit 93cc658

Browse files
committed
Reduce size of ringbuffer
1 parent 5e27d1a commit 93cc658

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tracer/tracer.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,12 +624,14 @@ func loadAllMaps(coll *cebpf.CollectionSpec, cfg *Config,
624624

625625
adaption["sched_times"] = schedTimesSize(cfg.OffCPUThreshold)
626626

627-
// Allow for 10s of 'burst' trace data
628-
// TODO: Change to present CPUs as runtime.NumCPU is fixed for the lifetime of the process?
629-
ringbufSize := 10 * uint32(cfg.SamplesPerSecond*runtime.NumCPU()*support.Sizeof_Trace)
630-
627+
// Allow for 1s of 'burst' trace data
628+
// TODO: Base this on present CPUs instead, as runtime.NumCPU is fixed
629+
// for the lifetime of the process?
630+
ringbufSize := uint32(cfg.SamplesPerSecond * runtime.NumCPU() * support.Sizeof_Trace)
631631
adaption["trace_events"] = uint32(util.NextPowerOfTwo(uint(ringbufSize)))
632632

633+
log.Infof("Using %d bytes ringbuffer size")
634+
633635
for i := support.StackDeltaBucketSmallest; i <= support.StackDeltaBucketLargest; i++ {
634636
mapName := fmt.Sprintf("exe_id_to_%d_stack_deltas", i)
635637
adaption[mapName] = 1 << uint32(exeIDToStackDeltasSize+cfg.MapScaleFactor)

0 commit comments

Comments
 (0)