How can I measure the memory usage of individual C functions?
Especially peak dynamic and/or stack allocation during the function, not just a heap allocation delta from entry to exit. Memory usage isn't like CPU usage where get_cpu_time
at the start/end of a function does tell you something useful for large functions.
Over multiple calls to a function, max and median or mean would be interesting, especially if we can see how it scales with a function arg.
Total cache footprint touched during execution would also be interesting.