Access bpf maps data in batch / copy bpf_map data and clear it in one syscall
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
I am developing a network telemetry system in which I need to read all the data from ebpf table, make a copy in userspace and clear the table.
Currently, I am doing like:
```
arr = []
for k in bpf_map:
arr.append([k,bpf_map[k]])
del bpf_map[k]
```
On profiling, I have found that the `next()` function takes the maximum amount of time for the program., i.e. iterating through keys and values takes the maximum amount of time.
To the best of my knowledge, ebpf and bcc provides methods to only iterate over map and nothing for this purpose.
Is there any way to copy the bpf_map data and then clear it in a whole batch from user space? If not bcc, is it possible if one uses native ebpf?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.