The only way I can see doing this at compile time is with a compiler extension but then you are entirely locked in to 1 compiler.
Maybe if you compile with debug symbols but then well, you are shipping debug symbols...
The only way I can see doing this at compile time is with a compiler extension but then you are entirely locked in to 1 compiler.
Maybe if you compile with debug symbols but then well, you are shipping debug symbols...
If you want to really zoom, you need to get the hooks inlined and probably just written in straight assembly. You then need to optimize your binary format and recording system. You then need to start optimizing your memory bandwidth usage when that becomes the bottleneck. Your overhead in the end is basically limited by memory bandwidth; you can only shovel so many tens of GB/s of logging into memory. Note that persistence has likely been infeasible for the last 2 or so orders of magnitude; RAM is likely the only storage consistently fast enough for the data rates you want to generate when doing this.