Prev Next Index-> contents reference index search external Up-> CppAD utility time_test CppAD-> Install Introduction AD ADFun preprocessor multi_thread utility ipopt_solve Example speed Appendix utility-> ErrorHandler NearEqual speed_test SpeedTest time_test test_boolofvoid NumericType CheckNumericType SimpleVector CheckSimpleVector nan pow_int Poly LuDetAndSolve RombergOne RombergMul Runge45 Rosen34 OdeErrControl OdeGear OdeGearControl CppAD_vector thread_alloc index_sort to_string set_union sparse_rc sparse_rcv time_test-> elapsed_seconds time_test.cpp Headings-> Syntax Purpose Motivation Include test ---..size ---..repeat time_min test_size time Timing Example

Determine Amount of Time to Execute a Test

Syntax
# include <cppad/utility/time_test.hpp>  time = time_test(test, time_min)  time = time_test(test, time_min, test_size)

Purpose
The time_test function executes a timing test and reports the amount of wall clock time for execution.

Motivation
It is important to separate small calculation units and test them individually. This way individual changes can be tested in the context of the routine that they are in. On many machines, accurate timing of a very short execution sequences is not possible. In addition, there may be set up and tear down time for a test that we do not really want included in the timing. For this reason time_test automatically determines how many times to repeat the section of the test that we wish to time.

Include
The file cppad/time_test.hpp defines the time_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.

test
The time_test argument test is a function, or function object. In the case where test_size is not present, test supports the syntax       test(repeat)  In the case where test_size is present, test supports the syntax       test(size, repeat)  In either case, the return value for test is void.

size
If the argument size is present, it has prototype       size_t size  and is equal to the test_size argument to time_test.

repeat
The test argument repeat has prototype       size_t repeat  It will be equal to the size argument to time_test.

time_min
The argument 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 (or more) is reached.

test_size
This argument has prototype       size_t test_size  It specifies the size argument to test .

time
The return value time has prototype       double time  and is the number of wall clock seconds that it took to execute test divided by the value used for repeat .

Timing
The routine elapsed_seconds will be used to determine the amount of time it took to execute the test.

Example
The routine time_test.cpp is an example and test of time_test.