()
| 116 | } |
| 117 | |
| 118 | func (this *ContextEvent) ParsePadding() (err error) { |
| 119 | // 好在 SampleSize 是明确的 这样我们可以正确计算下一部分 perf 数据起始位置 |
| 120 | // ebpf库改为全部读取之后 这里的 4 是 PERF_SAMPLE_RAW 的 size |
| 121 | padding_size := this.rec.SampleSize + 4 - uint32(this.buf.Cap()-this.buf.Len()) |
| 122 | if padding_size > 0 { |
| 123 | payload := make([]byte, padding_size) |
| 124 | if err = binary.Read(this.buf, binary.LittleEndian, &payload); err != nil { |
| 125 | this.logger.Printf("ContextEvent EventId:%d RawSample:\n%s", this.EventId, util.HexDump(this.rec.RawSample, util.COLORRED)) |
| 126 | panic(err) |
| 127 | } |
| 128 | } |
| 129 | return nil |
| 130 | } |
| 131 | |
| 132 | func (this *ContextEvent) ParseEvent() (IEventStruct, error) { |
| 133 | switch this.rec.RecordType { |
no test coverage detected