Detailed Description

A class that measures elapsed time can be useful when debugging, optimizing, or comparing implementations. timer_t utilizes the most accurate timing API a platform has to offer to maximize accuracy, while keeping the public API generic.

Note that in the above case the two implementations are tested in the same for loop. This is in attempt to distribute possible overhead from memory locality issues (i.e., do_my_func could push memory used by do_their_func out of the cache, unfairly slowing do_their_func down (or vice versa).

Depending on what you are measuring in your own code, measurement strategies may vary from the ones used above.