| 278 | } |
| 279 | |
| 280 | func (this *Module) PrePare(em *ebpf.Map, rec perf.Record) (event event.IEventStruct, err error) { |
| 281 | // 首先根据map得到最开始设置好的用于解析的结构体引用(这样描述可能不对) |
| 282 | es, found := this.child.DecodeFun(em) |
| 283 | if !found { |
| 284 | err = fmt.Errorf("%s\tcan't found decode function :%s, address:%p", this.child.Name(), em.String(), em) |
| 285 | return nil, err |
| 286 | } |
| 287 | te := es.Clone() |
| 288 | te.SetLogger(this.logger) |
| 289 | te.SetConf(this.child.GetConf()) |
| 290 | te.SetRecord(rec) |
| 291 | return te, nil |
| 292 | } |
| 293 | |
| 294 | func (this *Module) Close() error { |
| 295 | this.logger.Printf("TotalLost => %d\n", this.TotalLost) |