iovisor / iovisor/bcc

Access bpf maps data in batch / copy bpf_map data and clear it in one syscall

Open
#3,181 1 comment 1 reaction 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.