Re: [PATCH bpf-next 09/12] bpftool: Display missed count for kprobe_multi link

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/08/2023 08:55, Jiri Olsa wrote:
> Adding 'missed' field to display missed counts for kprobes
> attached by kprobe multi link, like:
> 
>   # bpftool link
>   5: kprobe_multi  prog 76
>           kprobe.multi  func_cnt 1 missed 1
>           addr             func [module]
>           ffffffffa039c030 fp3_test [fprobe_test]
> 
>   # bpftool link -jp
>   [{
>           "id": 5,
>           "type": "kprobe_multi",
>           "prog_id": 76,
>           "retprobe": false,
>           "func_cnt": 1,
>           "missed": 1,
>           "funcs": [{
>                   "addr": 18446744072102723632,
>                   "func": "fp3_test",
>                   "module": "fprobe_test"
>               }
>           ]
>       }
>   ]
> 
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
>  tools/bpf/bpftool/link.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
> index 0b214f6ab5c8..7387e51a5e5c 100644
> --- a/tools/bpf/bpftool/link.c
> +++ b/tools/bpf/bpftool/link.c
> @@ -265,6 +265,7 @@ show_kprobe_multi_json(struct bpf_link_info *info, json_writer_t *wtr)
>  	jsonw_bool_field(json_wtr, "retprobe",
>  			 info->kprobe_multi.flags & BPF_F_KPROBE_MULTI_RETURN);
>  	jsonw_uint_field(json_wtr, "func_cnt", info->kprobe_multi.count);
> +	jsonw_uint_field(json_wtr, "missed", info->kprobe_multi.missed);
>  	jsonw_name(json_wtr, "funcs");
>  	jsonw_start_array(json_wtr);
>  	addrs = u64_to_ptr(info->kprobe_multi.addrs);
> @@ -640,7 +641,9 @@ static void show_kprobe_multi_plain(struct bpf_link_info *info)
>  		printf("\n\tkretprobe.multi  ");
>  	else
>  		printf("\n\tkprobe.multi  ");
> -	printf("func_cnt %u  ", info->kprobe_multi.count);
> +	printf("func_cnt %u", info->kprobe_multi.count);
> +	if (info->kprobe_multi.missed)
> +		printf(" missed %llu", info->kprobe_multi.missed);

Nit: If you respin, please conserve the double space at the beginning of
"  missed %llu", to visually help separate from the previous field in
the plain output.

Looks good otherwise, thanks!

Reviewed-by: Quentin Monnet <quentin@xxxxxxxxxxxxx>

>  	addrs = (__u64 *)u64_to_ptr(info->kprobe_multi.addrs);
>  	qsort(addrs, info->kprobe_multi.count, sizeof(__u64), cmp_u64);
>  





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux