Motivation
"Yesterday I was working on some code, that I think is time critical. So I wrote myself a file, a really little test project, to visualize the elapsed CPU cycles (of my life) that passed while executing the mentioned code block. As the work progressed I also wanted to see the differences, measured in cycles, between single versions, or in other words how good or bad I was in optimizing it. I wasn't quite finished with my work when I suddenly saw, that the little speed testing utility could be something, that I might share." I wrote this text some time ago. Since then my benchmark evolved...
Description

Usage
- Create new empty console project.
- Add benchmark.h and benchmark.cpp into the project.
- Add an empty .cpp file into the project. Your .cpp file should have following layout:
#include <benchmark.h>
START_BENCHMARK
SET_DESCRIPTION(formatting string)
SET_CACHING_ITERATIONS(integer)
SET_TESTING_ITERATIONS(integer)
SET_ENVIRONMENT(boolean)
BEGIN_CACHING
FINISH_CACHING
EXEBLOCK_A
EXEBLOCK_B
EVALUATE
CLOSE_BENCHMARK
- Compile the project and run the benchmark:
<appname> [[-f name | -c state | -a number | -i number] | [-h]]
f - specify log file 'name', if you omit this parameter
the default name 'benchmark.log' will be used
c - runs the tests in 'state' 0 (dirty) or 1 (clean)
if you have hard coded the 'states' of your tests,
this parameter has no effect
a - sets the global 'number' of caching iterations,
if you have hard coded this value for your tests,
this parameter has no effect
i - sets the global 'number' of testing iterations,
if you have hard coded this value for your tests,
this parameter has no effect
h - shows this help
Last Words
That's all. For further info on this topic take a look at the:
- Approximate Math Library for Intel® Streaming SIMD Extensions.
- How to optimize for the Pentium family of microprocessors, By Agner Fog, Ph.D. Copyright © 1996 - 2004.