func (m *PerfMap) listen() {
	m.probe.monitor.wg.Add(1)
	var sample *ebpf.PerfSample
	var ok bool
	var lostCount uint64
	for {
		select {
		case <-m.stop:
			m.probe.monitor.wg.Done()
			return
		case sample, ok = <-m.perfReader.Samples:
			if !ok {
				m.probe.monitor.wg.Done()
				return
			}
			m.DataHandler(sample.Data, m.probe.monitor)
		case lostCount, ok = <-m.perfReader.LostRecords:
			if !ok {
				m.probe.monitor.wg.Done()
				return
			}
			if m.LostHandler != nil {
				m.LostHandler(lostCount, m.PerfOutputMapName, m.probe.monitor)
			}
		}
	}
}
// listen - Listen for new events from the kernel
Listen for new events from the kernel
// listen - Listen for new events from the kernel
func (m *PerfMap) listen() {
	m.probe.monitor.wg.Add(1)
	var sample *ebpf.PerfSample
	var ok bool
	var lostCount uint64
	for {
		select {
		case <-m.stop:
			m.probe.monitor.wg.Done()
			return
		case sample, ok = <-m.perfReader.Samples:
			if !ok {
				m.probe.monitor.wg.Done()
				return
			}
			m.DataHandler(sample.Data, m.probe.monitor)
		case lostCount, ok = <-m.perfReader.LostRecords:
			if !ok {
				m.probe.monitor.wg.Done()
				return
			}
			if m.LostHandler != nil {
				m.LostHandler(lostCount, m.PerfOutputMapName, m.probe.monitor)
			}
		}
	}
}
func ( m * PerfMap ) listen ( ) { m . probe . monitor . wg . Add ( 1 ) var sample * ebpf . PerfSample var ok bool var lostCount uint64 for { select { case <- m . stop : m . probe . monitor . wg . Done ( ) return case sample , ok = <- m . perfReader . Samples : if ! ok { m . probe . monitor . wg . Done ( ) return } m . DataHandler ( sample . Data , m . probe . monitor ) case lostCount , ok = <- m . perfReader . LostRecords : if ! ok { m . probe . monitor . wg . Done ( ) return } if m . LostHandler != nil { m . LostHandler ( lostCount , m . PerfOutputMapName , m . probe . monitor ) } } } }
Listen for new events from the kernel
Listen for new events from the kernel