-
this code send msg is only 48. but read from pref is bigger than. [root@c7-1 ~]# grep "0403770e5ca262d6760000007600010029" pref.log |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @llhhbc, this is indeed a great question. :) Depending on the size of the input passed to Note that the padding bytes are not cleared, so once the ring wraps the page boundary, you'll start seeing garbage show up where there were zeroes before. This behaviour is documented on tl;dr: what you're seeing is normal, the trailing data is safe to ignore. See this thread for more info: #94 (comment). |
Beta Was this translation helpful? Give feedback.
Hey @llhhbc, this is indeed a great question. :) Depending on the size of the input passed to
perf_event_output
in your BPF program, there can be between 0 and 7 extra bytes at the end of perf event records. The kernel aligns the event header (4 bytes) plus the input to 64 bits, but the[]byte
returned from Reader.Read() won't include the header. This means you can expect slices of length 4, 12, 20, 28 etc. bytes depending on the length of your input.Note that the padding bytes are not cleared, so once the ring wraps the page boundary, you'll start seeing garbage show up where there were zeroes before. This behaviour is documented on
Record.RawSample
. I've sent a patch upstream to zero t…