Tools.h++ Manual

21-12 104011 Tandem Computers Incorporated
21
Public constructors
RWBench(double duration = 5, unsigned long ILO=1000,
const char* machine = 0);
The parameter
duration
is the nominal amount of time that the benchmark
should take in seconds. The virtual function
doLoop(unsigned long)
will
be called over and over again until at least this amount of time has elapsed.
The parameter
ILO
is the number of "inner loop operations" that should be
performed. This parameter will be passed in as parameter
N
to
doLoop(N)
.
Parameter
machine
is an optional zero terminated string that should describe
the test environment (perhaps the hardware the benchmark is being run on ).
Public member functions
virtual void doLoop(unsigned long N)=0;
A pure virtual function whose actual definition should be supplied by the
specializing class. This function will be repeatedly called until a time duration
has elapsed. It should perform the operation to be benchmarked
N
times. See
the example.
double duration() const;
Return the current current setting for the benchmark test duration. This
should not be confused with function
time()
which returns the actual test
time.
virtual void go();
Call this function to actually run the benchmark.
virtual void idleLoop(unsigned long N);
This function can help to correct the benchmark for overhead. The default
definition merely executes a
"for()"
loop
N
times. See the example.
virtual void parse(int argc, char* argv[]);
This function allows an easy way to change the test duration, number of inner
loops and machine description from the command line:
Table 21-1
Argument Type Description
argv[1] double
Duration (sec.)
argv[2] unsigned long
No. of inner loops
argv[3] const char*
Machine