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

Method ParsePadding

user/event/event_context.go:118–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116}
117
118func (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
132func (this *ContextEvent) ParseEvent() (IEventStruct, error) {
133 switch this.rec.RecordType {

Callers 2

ParseContextMethod · 0.80
ParseContextMethod · 0.80

Calls 1

HexDumpFunction · 0.92

Tested by

no test coverage detected