Prev | Next |
# include <cppad/utility/speed_test.hpp>
rate_vec = speed_test(test, size_vec, time_min)
speed_test
function executes a speed test
for various sized problems
and reports the rate of execution.
speed_test
automatically determines how many times to
repeat the section of the test that we wish to time.
cppad/utility/speed_test.hpp
defines the
speed_test
function.
This file is included by cppad/cppad.hpp
and it can also be included separately with out the rest of
the CppAD
routines.
Vector
to denote a
simple vector class
with elements
of type size_t
.
speed_test
argument
test
is a function with the syntax
test(size, repeat)
and its return value is void
.
test
argument
size
has prototype
size_t size
It specifies the size for this test.
test
argument
repeat
has prototype
size_t repeat
It specifies the number of times to repeat the test.
speed_test
argument
size_vec
has prototype
const Vector& size_vec
This vector determines the size for each of the tests problems.
time_min
has prototype
double time_min
It specifies the minimum amount of time in seconds
that the
test
routine should take.
The
repeat
argument to
test
is increased
until this amount of execution time is reached.
rate_vec
has prototype
Vector& rate_vec
We use @(@
n
@)@ to denote its size which is the same as
the vector
size_vec
.
For @(@
i = 0 , \ldots , n-1
@)@,
rate_vec[i]
is the ratio of
repeat
divided by time in seconds
for the problem with size
size_vec[i]
.
gettimeofday
function,
it will be used to measure time.
Otherwise,
time is measured by the difference in
(double) clock() / (double) CLOCKS_PER_SEC
in the context of the standard <ctime>
definitions.
speed_test
.