google/benchmark ? reverse-engineered prompt
Reverse engineered prompt
Build me a small C++ benchmarking library for timing code snippets, kind of like unit tests but for performance. I want to be able to write a benchmark function that gets a state object, loop over that state so only the important code is timed, register the function with a simple macro, and then run everything from one executable. It should also support using a built in main function if I do not want to write my own.
Please make it easy to build and use with CMake, including a normal build, tests, and install support. I should be able to link it into another CMake project either after installing it or by including it directly in the source tree. Add a couple of simple example benchmarks so I can confirm it works right away.
Keep the library focused and practical, with clear docs for building, running, and integrating it. If needed, look up the current docs online and follow common C++ benchmarking conventions.
Are you gonna build this?
make sure you review the code using coderabbit