Hi,
The two previous versions tried to combine bpf output data with the
sample event of the attached kprobe point, which leads to problems
about perf_trace_buf.
After discussion we found it's not necessary to combine those two
parts of information, even we do not need the orignial kprobe output
event at all. Based on this idea, the implementation becomes simple,
just like what perf do with ftrace:functions, we set up a bpf ftrace
entry for perf tools to poll and collect data on it, eBpf program use
a helper function to submit data to ring-buffer, that's all. This
implementation also leaves all issues such as sample-types to perf
commandline.
Currently, we just use raw data in the format fields to not interfere
perf sample parser, because the raw-data can be parsed by perf script
plugin easily.
bpf_output_sample(&del_time, sizeof(del_time));
Record bpf events:
$ perf record -e ftrace:bpf -e sample.o -- dd if=/dev/zero of=test bs=4k count=3
The results showed in perf-script:
$ perf script
dd 994 [000] 166.686779: ftrace:bpf: 8: (000000000542b426, ...)
dd 994 [000] 166.686779: ftrace:bpf: 8: (00000000001011ef, ...)
dd 994 [000] 166.686779: ftrace:bpf: 8: (000000000007a2b6, ...)