The Bench++ Benchmark Suite
by Joseph M. Orost


Listing One 
if(local < global) {
 flag = true;
} else {
 flag = false;
}


Listing Two
// Control loop
start = cpu_time_clock();
for(int i = 1; i <= nr_iterations; i++) {
 Trick_Optimizer();
}
stop = cpu_time_clock();
control_loop_overhead = stop - start;

// Test Loop
start = cpu_time_clock();
for(int i = 1; i <= nr_iterations; i++) {
 Trick_Optimizer();
 feature;
}
stop = cpu_time_clock();
test_loop_overhead = stop - start;
feature_overhead = (test_loop_overhead - control_loop_overhead) /
 nr_iterations;


Listing Three
 #include "a000010.h" // duration
#include "a000021.h" // break_optimization
#include "a000031.h" // iteration
#include "a000047.h" // bench_plus_plus_timer_generic

void
TESTNAME_control(void)
{
iteration::increment(break_optimization::global);
// Code here to mask overhead effects of the code to be measured.
}
void
TESTNAME_test(void)
{
 iteration::increment(break_optimization::global);
 // Code to be measured goes here
}
void
TESTNAME(void) // main procedure
{
 scale scale = automatic;
 bench_plus_plus_timer_generic(scale,
 TESTNAME_control,
 TESTNAME_test,
 "TESTNAME",
 "TEST-CLASS",
 "Description: line 1",
 " line 2",
 " line 3");
}




2


