To follow up the @linas comment: here and to not reinvent the wheel I would propose using some ready C++ benchmarking library.
Requirements to such library:
- ability to keep run results
- ability to compare run results
- showing info on system which is used to perform test
- anti-optimization tricks
Google Benchmark (https://github.com/google/benchmark) seems to be a good candidate. Unfortunately there are no ready to install packages for benchmark libraries so it will be additional manual step in building procedure.
Other well known libraries:
Some review and comparision can be found here (full articles are here and here).