Open brancz opened 3 years ago
That's neat. How far do you want to take this? Some part of this screams plain prometheus "exporter" for USDT or any uprobe. But the combination of counter + backtrace for anything (sent UDP packets, bytes, number of CPU migrations, ...) is really interesting.
I think I'd like to see us building full profiles with the stack traces that call the allocation causing functions. I think it would be neat to build two separate profiles
1) the number of allocations 2) the amount of memory allocated
The differentiation can be interesting because often CPU can be improved not by allocating less memory in total, but just more contiguous memory at once.
Aside from CPU profiling, allocation profiling is very useful as well, especially because a lot of CPU is spent on poor allocation practices. Allocation profiling can also be useful for troubleshooting memory leaks.
This can be done using USDT (Userland Statically Defined Tracing) using
uprobe
. It's likely that this will require language/runtime specific implementations (see bcc's uobjnew).