|
Prev
| Next
|
|
|
|
|
|
elapsed_seconds.cpp |
Headings |
@(@\newcommand{\W}[1]{ \; #1 \; }
\newcommand{\R}[1]{ {\rm #1} }
\newcommand{\B}[1]{ {\bf #1} }
\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }
\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }
\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }
\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
This is cppad-20221105 documentation. Here is a link to its
current documentation
.
Elapsed Seconds: Example and Test
# include <cppad/utility/elapsed_seconds.hpp>
# include <iostream>
# include <algorithm>
# include <cmath>
# define CPPAD_DEBUG_ELAPSED_SECONDS 0
bool elapsed_seconds(void)
{ bool ok = true;
double max_diff = 0.;
double s0 = CppAD::elapsed_seconds();
double s1 = CppAD::elapsed_seconds();
double s2 = CppAD::elapsed_seconds();
while(s2 - s0 < 1.)
{ max_diff = std::max(s2 - s1, max_diff);
s1 = s2;
s2 = CppAD::elapsed_seconds();
}
# if CPPAD_DEBUG_ELAPSED_SECONDS
std::cout << "max_diff = " << max_diff << std::endl;
# endif
ok &= 0. < max_diff && max_diff < .04;
return ok;
}
Input File: speed/example/elapsed_seconds.cpp