(map_e event.IEventStruct)
| 44 | } |
| 45 | |
| 46 | func (this *EventProcessor) dispatch(map_e event.IEventStruct) { |
| 47 | // 如果需要dump那就直接写到文件中去 |
| 48 | if map_e.DumpRecord() { |
| 49 | return |
| 50 | } |
| 51 | // 在接收到数据之后就已经绑定了对应的事件 所以这里常规逻辑应该是直接开始解析 |
| 52 | // 实际上绑定的是单一事件 由于perf event flag的设置不同 读取到的还有其他类型的数据 |
| 53 | // 比如 fork exit 之类的 并非只有 sample |
| 54 | // 也就是这里需要根据数据类型的不同解析为不同的事件 |
| 55 | data_e, err := map_e.ParseEvent() |
| 56 | if err != nil { |
| 57 | // 异常日志在 ParseEvent 进行输出 |
| 58 | // 因为有的的 Record 需要跳过 并非错误 |
| 59 | this.logger.Printf("ParseEvent faild, err:%v", err) |
| 60 | return |
| 61 | } |
| 62 | if data_e == nil { |
| 63 | // 比如是自己的 mmap2 事件 直接忽略调 |
| 64 | return |
| 65 | } |
| 66 | // 单就输出日志来说 下面这样做反而给人一种输出有延迟的感觉 如果没有必要就去掉这部分吧 |
| 67 | var uuid string = data_e.GetUUID() |
| 68 | found, eWorker := this.getWorkerByUUID(uuid) |
| 69 | if !found { |
| 70 | // ADD a new eventWorker into queue |
| 71 | eWorker = NewEventWorker(data_e.GetUUID(), this) |
| 72 | this.addWorkerByUUID(eWorker) |
| 73 | } |
| 74 | err = eWorker.Write(data_e) |
| 75 | if err != nil { |
| 76 | //... |
| 77 | this.GetLogger().Fatalf("write event failed , error:%v", err) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | //func (this *EventProcessor) Incoming() chan user.IEventStruct { |
| 82 | // return this.incoming |
no test coverage detected