Struct redbpf::PerCpuArray [−][src]
pub struct PerCpuArray<'a, T: Clone> { /* fields omitted */ }
Expand description
Per-cpu array map corresponding to BPF_MAP_TYPE_PERCPU_ARRAY
Example
use redbpf::{load::Loader, PerCpuArray, PerCpuValues};
let loaded = Loader::load(b"biolatpcts.elf").expect("error loading BPF program");
let biolat = PerCpuArray::<u64>::new(loaded.map("biolat").expect("arr not found")).expect("error creating Array in userspace");
let mut values = PerCpuValues::new(0);
values[0] = 1;
values[1] = 10;
biolat.set(0, &values);
This structure is used by userspace programs. For BPF program’s API, see redbpf_probes::maps::PerCpuArray
Implementations
Set per-cpu values
to the BPF map
The number of elements in values
should be equal to the number of
possible CPUs. It is guranteed if values
is created by
PerCpuValues::new
This method can fail if index
is out of bound of array map.
Get per-cpu values from the BPF map
Get per-cpu values at index
. This method returns
PerCpuValues
This method can return None if index
is out of bound.
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for PerCpuArray<'a, T> where
T: RefUnwindSafe,
impl<'a, T> Send for PerCpuArray<'a, T> where
T: Send,
impl<'a, T> Sync for PerCpuArray<'a, T> where
T: Sync,
impl<'a, T> Unpin for PerCpuArray<'a, T> where
T: Unpin,
impl<'a, T> UnwindSafe for PerCpuArray<'a, T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more