-
Notifications
You must be signed in to change notification settings - Fork 357
Description
Hello,
I am opening this issue because I thought it would be great to have memory profiling integrated to the opentelemetry-ebpf-profiler, and this is something I would like to tackle if it is decided that it is possible to do so.
Here is the strategy I imagine:
- eBPF program on Uprobe Entry (malloc/calloc/realloc...): Captures the size parameter
- eBPF program on Uretprobe Exit: Captures the returned memory address -> send alloc event
- eBPF program on Uprobe on Free: Captures the address being freed -> send free event
- User space needs to keep track of stack_traces holding > 0 memory alloc (not sure about how to make this part efficient)
For that I imagine that we could reuse the current eBPF architecture but with a TRACE_MEMORY origin, that would also send the memory alloc/free metadata and user space would do the correlation with trace_events and potential memory_events map.
Or creating a dedicated eBPF architecture for collecting stack_traces and memory metadata to be sent to user space when a memory alloc/free is triggered.
This is a naive intuition so far that would only capture virtual memory, but I think this is a beginning. so let me know what do you think !