On Mon, 2 Feb 2026 19:15:48 +0800
Donglin Peng <[email protected]> wrote:
> @@ -754,6 +755,14 @@ void print_function_args(struct trace_seq *s, unsigned
> long *args,
> break;
> case BTF_KIND_ENUM:
> trace_seq_printf(s, "%ld", arg);
> + for_each_enum(i, t, enump) {
> + if (arg == enump->val) {
> + trace_seq_printf(s, " [%s]",
> + btf_name_by_offset(btf,
> + enump->name_off));
> + break;
> + }
> + }
> break;
I have to ask; how big is that enum list?
Do we really want to do a linear search for every enum we come across?
What we could do is for the first time we hit an enum, create an array of
enums, sort them, and do a binary search from then on. This could be saved
in the tracing code itself (in kernel/trace/trace_btf.c), if BPF doesn't
care about it.
-- Steve