benchmarkC

A toolbox for (micro)benchmarking of C programs on x86_64. Additionally tested for Barrelfish on ARM.

Performance matters a lot. There are lots of pitfalls when the performance of a code is assessed. This toolbox here is not even trying to compete with available professional profiling tools. Also for microbenchmarking, I recommend/use google/benchmark that was showcased in this excellent presentation by Chandler Carruth about microbenchmarking at CppCon 2015.

Recently, I have been using LibSciBench, the benchmark library published by Prof. Torsten Hoefler et al. (Scalable Parallel Computing Lab, SPCL, ETH Zürich). It is part of excellent guidelines on scientific benchmarking [1]. A great read!

Nevertheless, benchmarkC works well for exercises and to learn first-hand about some of the pitfalls associated with benchmarking and learn about some interesting/surprising results while testing programs on current processors (see e.g. example 2; no spoilers here). It uses rdtsc.h from here based on a paper by G. Paoloni (link). It was written for OSX (Clang) and also tested on Fedora (GCC). And, it comes with some convenient statistics goodies that may be useful to you in other applications as well. It has been used in our Advanced Operating Systems 2017 class group project (Barrelfish OlympOS) running Barrelfish on a Pandaboard ES (ARMv7).

A more advanced descriptive statistics module written in C++14 without rdtsc is available in my CppToolbox: StatisticsHelper.

Current version v1.2 (2017-11-22). Source code and examples on my github page

References

  1. Hoefler T, Belli R. Scientific Benchmarking of Parallel Computing Systems. Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis (SC15) 2015;73:1-12, link