Codebase list cppad / upstream/2015.00.00.7 doc / elapsed_seconds.cpp.xml
upstream/2015.00.00.7

Tree @upstream/2015.00.00.7 (Download .tar.gz)

elapsed_seconds.cpp.xml @upstream/2015.00.00.7raw · history · blame

<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Elapsed Seconds: Example and Test</title>
<meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
<meta name="description" id="description" content="Elapsed Seconds: Example and Test"/>
<meta name="keywords" id="keywords" content=" elapsed seconds: example and test seconds timer "/>
<style type='text/css'>
body { color : black }
body { background-color : white }
A:link { color : blue }
A:visited { color : purple }
A:active { color : purple }
</style>
<script type='text/javascript' language='JavaScript' src='_elapsed_seconds.cpp_xml.js'>
</script>
</head>
<body>
<table><tr>
<td>
<a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a>
</td>
<td><a href="elapsed_seconds.xml" target="_top">Prev</a>
</td><td><a href="time_test.cpp.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</option>
<option>contents</option>
<option>reference</option>
<option>index</option>
<option>search</option>
<option>external</option>
</select>
</td>
<td>
<select onchange='choose_up0(this)'>
<option>Up-&gt;</option>
<option>CppAD</option>
<option>library</option>
<option>time_test</option>
<option>elapsed_seconds</option>
<option>elapsed_seconds.cpp</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>library-&gt;</option>
<option>ErrorHandler</option>
<option>NearEqual</option>
<option>speed_test</option>
<option>SpeedTest</option>
<option>time_test</option>
<option>NumericType</option>
<option>CheckNumericType</option>
<option>SimpleVector</option>
<option>CheckSimpleVector</option>
<option>nan</option>
<option>pow_int</option>
<option>Poly</option>
<option>LuDetAndSolve</option>
<option>RombergOne</option>
<option>RombergMul</option>
<option>Runge45</option>
<option>Rosen34</option>
<option>OdeErrControl</option>
<option>OdeGear</option>
<option>OdeGearControl</option>
<option>CppAD_vector</option>
<option>thread_alloc</option>
<option>index_sort</option>
<option>BenderQuad</option>
<option>opt_val_hes</option>
<option>LuRatio</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>time_test-&gt;</option>
<option>elapsed_seconds</option>
<option>time_test.cpp</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>elapsed_seconds-&gt;</option>
<option>elapsed_seconds.cpp</option>
</select>
</td>
<td>elapsed_seconds.cpp</td>
<td>Headings</td>
</tr></table><br/>



<center><b><big><big>Elapsed Seconds: Example and Test</big></big></b></center>
<code><font color="blue"><pre style='display:inline'> 
# include &lt;cppad/elapsed_seconds.hpp&gt;

# include &lt;iostream&gt;
# include &lt;algorithm&gt;
# include &lt;cmath&gt;

# 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 &lt; 1.)
	{	max_diff = std::max(s2 - s1, max_diff);
		s1 = s2;
		s2 = CppAD::elapsed_seconds();

	}
# if CPPAD_DEBUG_ELAPSED_SECONDS
	std::cout &lt;&lt; &quot;max_diff = &quot; &lt;&lt; max_diff &lt;&lt; std::endl;
# endif
	ok &amp;= 0. &lt; max_diff &amp;&amp; max_diff &lt; .04;
	return ok;
}

</pre>

</font></code>


<hr/>Input File: speed/example/elapsed_seconds.cpp

</body>
</html>