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.

Get length of array map

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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