Complete the port of benchmarking functions. It compiles on Ubuntu with gcc 4.6, still have to check on OS X