func (p *Probe) Start() error {
	if !p.Enabled {
		return nil
	}
	// Enable eBPF program
	collection := p.monitor.collection
	switch p.Type {
	case ebpf.TracePoint:
		if err := collection.EnableTracepoint(p.SectionName); err != nil {
			return err
		}
	case ebpf.Kprobe:
		maxActive := p.monitor.config.EBPF.KprobeMaxActive
		if p.KProbeMaxActive != 0 {
			maxActive = p.KProbeMaxActive
		}
		if err := collection.EnableKprobe(p.SectionName, maxActive); err != nil {
			return err
		}
	case ebpf.SchedCLS:
		sp := collection.Programs[p.SectionName]
		if sp == nil {
			return errors.New("SchedCLS program not found")
		}
		p.schedCLSFd = sp.FD()
		if err := p.addFilter(); err != nil {
			return err
		}
	case ebpf.CGroupSock, ebpf.CGroupSKB, ebpf.SockOps, ebpf.CGroupDevice:
		if err := collection.AttachCgroupProgram(p.SectionName, p.CgroupPath); err != nil {
			return err
		}
	}
	// start polling perf maps
	for _, m := range p.PerfMaps {
		if err := m.pollStart(); err != nil {
			return err
		}
	}
	return nil
}
// Start - Starts the probe
Starts the probe
// Start - Starts the probe
func (p *Probe) Start() error {
	if !p.Enabled {
		return nil
	}
	collection := p.monitor.collection
	switch p.Type {
	case ebpf.TracePoint:
		if err := collection.EnableTracepoint(p.SectionName); err != nil {
			return err
		}
	case ebpf.Kprobe:
		maxActive := p.monitor.config.EBPF.KprobeMaxActive
		if p.KProbeMaxActive != 0 {
			maxActive = p.KProbeMaxActive
		}
		if err := collection.EnableKprobe(p.SectionName, maxActive); err != nil {
			return err
		}
	case ebpf.SchedCLS:
		sp := collection.Programs[p.SectionName]
		if sp == nil {
			return errors.New("SchedCLS program not found")
		}
		p.schedCLSFd = sp.FD()
		if err := p.addFilter(); err != nil {
			return err
		}
	case ebpf.CGroupSock, ebpf.CGroupSKB, ebpf.SockOps, ebpf.CGroupDevice:
		if err := collection.AttachCgroupProgram(p.SectionName, p.CgroupPath); err != nil {
			return err
		}
	}
	for _, m := range p.PerfMaps {
		if err := m.pollStart(); err != nil {
			return err
		}
	}
	return nil
}
func ( p * Probe ) Start ( ) error { if ! p . Enabled { return nil } collection := p . monitor . collection switch p . Type { case ebpf . TracePoint : if err := collection . EnableTracepoint ( p . SectionName ) ; err != nil { return err } case ebpf . Kprobe : maxActive := p . monitor . config . EBPF . KprobeMaxActive if p . KProbeMaxActive != 0 { maxActive = p . KProbeMaxActive } if err := collection . EnableKprobe ( p . SectionName , maxActive ) ; err != nil { return err } case ebpf . SchedCLS : sp := collection . Programs [ p . SectionName ] if sp == nil { return errors . New ( " " ) } p . schedCLSFd = sp . FD ( ) if err := p . addFilter ( ) ; err != nil { return err } case ebpf . CGroupSock , ebpf . CGroupSKB , ebpf . SockOps , ebpf . CGroupDevice : if err := collection . AttachCgroupProgram ( p . SectionName , p . CgroupPath ) ; err != nil { return err } } for _ , m := range p . PerfMaps { if err := m . pollStart ( ) ; err != nil { return err } } return nil }
Starts the probe
Starts the probe
// Enable eBPF program // start polling perf maps