From 7479c1dd6c1356bddb0401dbeea65618674524c9 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Fri, 10 Feb 2023 23:30:00 +0000 Subject: [PATCH] aya: More discrete feature logging Just use the Debug formatter vs. printing a message for each probe. Signed-off-by: Dave Tucker --- aya-obj/src/btf/btf.rs | 19 ------------------- aya/src/bpf.rs | 19 +------------------ 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/aya-obj/src/btf/btf.rs b/aya-obj/src/btf/btf.rs index 4dd4716c..f439ee1a 100644 --- a/aya-obj/src/btf/btf.rs +++ b/aya-obj/src/btf/btf.rs @@ -172,25 +172,6 @@ pub struct BtfFeatures { pub btf_type_tag: bool, } -impl std::fmt::Display for BtfFeatures { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_fmt(format_args!( - "[FEAT PROBE] BTF func support: {}\n\ - [FEAT PROBE] BTF global func support: {}\n\ - [FEAT PROBE] BTF var and datasec support: {}\n\ - [FEAT PROBE] BTF float support: {}\n\ - [FEAT PROBE] BTF decl_tag support: {}\n\ - [FEAT PROBE] BTF type_tag support: {}", - self.btf_func, - self.btf_func_global, - self.btf_datasec, - self.btf_float, - self.btf_decl_tag, - self.btf_type_tag, - )) - } -} - /// Bpf Type Format metadata. /// /// BTF is a kind of debug metadata that allows eBPF programs compiled against one kernel version diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index 2d71d88c..719f1195 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -96,28 +96,11 @@ impl Features { bpf_perf_link: is_perf_link_supported(), btf, }; - - debug!("{}", f); - if let Some(btf) = f.btf.as_ref() { - debug!("{}", btf) - } + debug!("BPF Feature Detection: {:#?}", f); f } } -impl std::fmt::Display for Features { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!( - "[FEAT PROBE] BPF program name support: {}\n\ - [FEAT PROBE] bpf_link support for kprobe/uprobe/tracepoint: {}\n\ - [FEAT PROBE] BTF support: {}", - self.bpf_name, - self.bpf_perf_link, - self.btf.is_some() - )) - } -} - /// Builder style API for advanced loading of eBPF programs. /// /// Loading eBPF code involves a few steps, including loading maps and applying