Skip to content

Commit

Permalink
aya: More discrete feature logging
Browse files Browse the repository at this point in the history
Just use the Debug formatter vs. printing a message for each probe.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
  • Loading branch information
dave-tucker committed Feb 12, 2023
1 parent d0b3d3b commit 7479c1d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
19 changes: 0 additions & 19 deletions aya-obj/src/btf/btf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 1 addition & 18 deletions aya/src/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7479c1d

Please sign in to comment.