/usr/share/doc/libitpp-dev/html/timer.html is in libitpp-doc 4.3.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Welcome to IT++!</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div style="width: 100%; height: 40px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<a href="http://itpp.sourceforge.net"><img src="itpp_logo.png" alt="IT++ Logo" style="float: left; border: 0;"></a>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<div class="left">
<form id="FSearchBox" action="search.php" method="get">
<img id="MSearchSelect" src="search/mag.png" alt=""/>
<input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"/>
</form>
</div><div class="right"></div>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Using timers to measure execution time </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>In this example we are using the Real_Timer class to measure the execution time of a simple program. The Real_Timer class is included in the itmisc library.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="itbase_8h.html">itpp/itbase.h</a>></span></div>
<div class="line"></div>
<div class="line"><span class="keyword">using namespace </span>itpp;</div>
<div class="line"></div>
<div class="line"><span class="comment">//These lines are needed for use of cout and endl</span></div>
<div class="line"><span class="keyword">using</span> std::cout;</div>
<div class="line"><span class="keyword">using</span> std::endl;</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main()</div>
<div class="line">{</div>
<div class="line"> <span class="comment">//Declare the scalars used:</span></div>
<div class="line"> <span class="keywordtype">long</span> i, <a class="code" href="group__matrix__functions.html#ga8907d7a7df866d4244dbc2679f7e3e58">sum</a>, N;</div>
<div class="line"></div>
<div class="line"> <span class="comment">//Declare tt as an instance of the timer class:</span></div>
<div class="line"> <a class="code" href="classitpp_1_1Real__Timer.html">Real_Timer</a> tt;</div>
<div class="line"></div>
<div class="line"> <span class="comment">//Initiate the variables:</span></div>
<div class="line"> N = 1000000;</div>
<div class="line"> sum = 0;</div>
<div class="line"></div>
<div class="line"> <span class="comment">//Start and reset the timer:</span></div>
<div class="line"> tt.<a class="code" href="classitpp_1_1Timer.html#afeed20347c7ba104cbddb62e76340bc7">tic</a>();</div>
<div class="line"></div>
<div class="line"> <span class="comment">//Do some processing</span></div>
<div class="line"> <span class="keywordflow">for</span> (i = 0; i < N; i++) {</div>
<div class="line"> sum += i;</div>
<div class="line"> }</div>
<div class="line"></div>
<div class="line"> <span class="comment">// Print the elapsed time</span></div>
<div class="line"> tt.<a class="code" href="classitpp_1_1Timer.html#adc264ac0276f798f33d229e17c66f8a5">toc_print</a>();</div>
<div class="line"></div>
<div class="line"> <span class="comment">//Print the result of the processing:</span></div>
<div class="line"> cout << <span class="stringliteral">"The sum of all integers from 0 to "</span> << N - 1 << <span class="stringliteral">" equals "</span> << sum << endl;</div>
<div class="line"></div>
<div class="line"> <span class="comment">//Exit program:</span></div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line"></div>
<div class="line">}</div>
</div><!-- fragment --><p>When you run this program, the output will look something like this:</p>
<div class="fragment"><div class="line">Elapsed time = 0.000797055 seconds</div>
<div class="line">The sum of <a class="code" href="namespaceitpp.html#aeb25a3bf9abece1e3b286676c4bc109d">all</a> integers from 0 <a class="code" href="group__fixed.html#ga70902adf445f4727d6498f0094e63809">to</a> 999999 equals 1783293664</div>
</div><!-- fragment --> </div></div><!-- contents -->
<div style="clear: both; width: 100%; height: 31px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=37044&type=1" alt="SourceForge Logo" style="float: right; border: 0;"></a>
<p style="padding-left: 10px; font-size: 85%;">Generated on Sat Mar 22 2014 05:34:27 for IT++ by <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.6</p>
</div>
</body>
</html>
|