>I was thinking about providing custom event formats for each bpf>>
>>>program (if needed). The event format definitions might be in a
>>>specific directory or a bpf object itself. Then perf can read those
>>>formats and print the output data according to the formats. Maybe we
>>>need to add some dynamic event id to match format and data.
>>I think we can do it in perf side. Let BPF programs themselves
>>encode format information into the array and make perf read and
>>decode them. In kernel side simply support raw data should be
>>enough, so we can make kernel code as simple as possible.
>Yes, of course, I also meant that doing those work all in perf side. :)
I have an idea on it:
struct x{
int a;
int b;
};
struct x __x;
SEC(...)
int func(void *ctx)
{
struct x myx;
...
myx.a = 1;
myx.b = 2;
OUTPUT(&myx, &__x);
...
}
In the above program, the '&' operator will emit a relocation,