MCPcopy Create free account
hub / github.com/SeeFlowerX/stackplz / readEvents

Method readEvents

user/module/imodule.go:157–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155}
156
157func (this *Module) readEvents() error {
158 var errChan = make(chan error, 8)
159 // 随时记录读取事件过程中的异常情况
160 go func() {
161 for {
162 select {
163 case err := <-errChan:
164 this.logger.Printf("%s\treadEvents error:%v", this.child.Name(), err)
165 }
166 }
167 }()
168 // 读取之前从eBPF程序中解析预设的map的事件数据
169 for _, ebpfMap := range this.child.Events() {
170 switch {
171 case ebpfMap.Type() == ebpf.PerfEventArray:
172 this.perfEventReader(errChan, ebpfMap)
173 default:
174 return fmt.Errorf("%s\tNot support mapType:%s , mapinfo:%s", this.child.Name(), ebpfMap.Type().String(), ebpfMap.String())
175 }
176 }
177
178 return nil
179}
180
181func (this *Module) getExtraOptions(em *ebpf.Map) perf.ExtraPerfOptions {
182 // 这里可以考虑在一开始的时候就完成初始化

Callers 1

RunMethod · 0.95

Calls 4

perfEventReaderMethod · 0.95
NameMethod · 0.65
EventsMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected