Profiling and code instrumentation
I’ve recently watched a video from TheCherno about visual benchmarking.
In short, he’s using a simple timer class in C++ to collect execution timings of his code and then generate a json file containing profiling data which can be visualised using chrome tracing.
He’s using a set of macros to automatically get function names when instrumenting the code.
This gave me an idea to actually use gcc instrumentation to inject the timers globally into the entire program and collect the data without having to manually instrument the code. Additionally, I’m gonna experiment with LLVM Xray instrumentation which makes the whole process even more simpler.
