root/doc/html/classitpp_1_1CPU__Timer.html @ 353

Revision 353, 11.8 kB (checked in by smidl, 15 years ago)

doc

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: itpp::CPU_Timer Class Reference</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
56      <li><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
62      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
63      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
64      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
65    </ul>
66  </div>
67  <div class="navpath"><b>itpp</b>::<a class="el" href="classitpp_1_1CPU__Timer.html">CPU_Timer</a>
68  </div>
69</div>
70<div class="contents">
71<h1>itpp::CPU_Timer Class Reference<br>
72<small>
73[<a class="el" href="group__timers.html">Timers</a>]</small>
74</h1><!-- doxytag: class="itpp::CPU_Timer" --><!-- doxytag: inherits="itpp::Timer" -->A CPU time timer class<p>
75Measures the time spent by the CPU on the current process. If two processes are running concurrently, one real seconds equal 5 CPU seconds per process. The resolution is not very good (in the order of 0.01 seconds). 
76<a href="#_details">More...</a>
77<p>
78<code>#include &lt;<a class="el" href="timing_8h-source.html">timing.h</a>&gt;</code>
79<p>
80
81<p>
82<a href="classitpp_1_1CPU__Timer-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
83<tr><td></td></tr>
84<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
85<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ee777faea591a3b98df411542b64d395"></a><!-- doxytag: member="itpp::CPU_Timer::CPU_Timer" ref="ee777faea591a3b98df411542b64d395" args="()" -->
86&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CPU__Timer.html#ee777faea591a3b98df411542b64d395">CPU_Timer</a> ()</td></tr>
87
88<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a new timer. Sets the time to zero. <br></td></tr>
89<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="430e4c8420c4acfd4c2b9cff842b0878"></a><!-- doxytag: member="itpp::CPU_Timer::start" ref="430e4c8420c4acfd4c2b9cff842b0878" args="(void)" -->
90void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#430e4c8420c4acfd4c2b9cff842b0878">start</a> (void)</td></tr>
91
92<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start the timer. This does not set the time to zero. <br></td></tr>
93<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e1793d23cbce8d1bd3497885da051e6f"></a><!-- doxytag: member="itpp::CPU_Timer::stop" ref="e1793d23cbce8d1bd3497885da051e6f" args="(void)" -->
94double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#e1793d23cbce8d1bd3497885da051e6f">stop</a> (void)</td></tr>
95
96<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Stop the timer. Returns the elapsed time in seconds. <br></td></tr>
97<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="cafdc07fe9e863c5ed9093224511ab8d"></a><!-- doxytag: member="itpp::CPU_Timer::reset" ref="cafdc07fe9e863c5ed9093224511ab8d" args="(double t=0.0)" -->
98void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#cafdc07fe9e863c5ed9093224511ab8d">reset</a> (double t=0.0)</td></tr>
99
100<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the time to time t, which is zero by default. Stops the timer if it is running. <br></td></tr>
101<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="feed20347c7ba104cbddb62e76340bc7"></a><!-- doxytag: member="itpp::CPU_Timer::tic" ref="feed20347c7ba104cbddb62e76340bc7" args="(void)" -->
102void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#feed20347c7ba104cbddb62e76340bc7">tic</a> (void)</td></tr>
103
104<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resets the timer and starts it. <br></td></tr>
105<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f19c4b9b6728cfa32e8e0492d1f54acb"></a><!-- doxytag: member="itpp::CPU_Timer::toc" ref="f19c4b9b6728cfa32e8e0492d1f54acb" args="(void)" -->
106double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#f19c4b9b6728cfa32e8e0492d1f54acb">toc</a> (void)</td></tr>
107
108<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the elapsed time since last <a class="el" href="classitpp_1_1Timer.html#feed20347c7ba104cbddb62e76340bc7" title="Resets the timer and starts it.">tic()</a>. <br></td></tr>
109<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="dc264ac0276f798f33d229e17c66f8a5"></a><!-- doxytag: member="itpp::CPU_Timer::toc_print" ref="dc264ac0276f798f33d229e17c66f8a5" args="(void)" -->
110void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#dc264ac0276f798f33d229e17c66f8a5">toc_print</a> (void)</td></tr>
111
112<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Prints the elapsed time since last <a class="el" href="classitpp_1_1Timer.html#feed20347c7ba104cbddb62e76340bc7" title="Resets the timer and starts it.">tic()</a>. <br></td></tr>
113<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="53aa5979d6ac8959d9443c1603de74bf"></a><!-- doxytag: member="itpp::CPU_Timer::get_time" ref="53aa5979d6ac8959d9443c1603de74bf" args="() const " -->
114double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#53aa5979d6ac8959d9443c1603de74bf">get_time</a> () const </td></tr>
115
116<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the elapsed time. <br></td></tr>
117<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
118<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="20bf24b632b5f049762c62b5ef57658d"></a><!-- doxytag: member="itpp::CPU_Timer::get_current_time" ref="20bf24b632b5f049762c62b5ef57658d" args="() const " -->
119double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CPU__Timer.html#20bf24b632b5f049762c62b5ef57658d">get_current_time</a> () const </td></tr>
120
121<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Vitrual function that returns teh current time. <br></td></tr>
122<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
123<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0d907992dcce3e43494e26ee5f8881cb"></a><!-- doxytag: member="itpp::CPU_Timer::start_time" ref="0d907992dcce3e43494e26ee5f8881cb" args="" -->
124double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#0d907992dcce3e43494e26ee5f8881cb">start_time</a></td></tr>
125
126<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The start time of the timer. <br></td></tr>
127<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e652cc2d3a428fc989dbfd30cfef62d9"></a><!-- doxytag: member="itpp::CPU_Timer::stop_time" ref="e652cc2d3a428fc989dbfd30cfef62d9" args="" -->
128double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#e652cc2d3a428fc989dbfd30cfef62d9">stop_time</a></td></tr>
129
130<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The stop time of the timer. <br></td></tr>
131<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="adcc1d37966cefe6150b5ebc55f44d7c"></a><!-- doxytag: member="itpp::CPU_Timer::elapsed_time" ref="adcc1d37966cefe6150b5ebc55f44d7c" args="" -->
132double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#adcc1d37966cefe6150b5ebc55f44d7c">elapsed_time</a></td></tr>
133
134<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The ellapsed time from start to stop. <br></td></tr>
135<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="aa44f4c306bea316f974e7f0a1f3c096"></a><!-- doxytag: member="itpp::CPU_Timer::running" ref="aa44f4c306bea316f974e7f0a1f3c096" args="" -->
136bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Timer.html#aa44f4c306bea316f974e7f0a1f3c096">running</a></td></tr>
137
138<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A bool that indicates if the timer is running or not. <br></td></tr>
139</table>
140<hr><a name="_details"></a><h2>Detailed Description</h2>
141A CPU time timer class<p>
142Measures the time spent by the CPU on the current process. If two processes are running concurrently, one real seconds equal 5 CPU seconds per process. The resolution is not very good (in the order of 0.01 seconds).
143<p>
144Usage: Define a time object: <div class="fragment"><pre class="fragment">  <a class="code" href="classitpp_1_1CPU__Timer.html#ee777faea591a3b98df411542b64d395" title="Create a new timer. Sets the time to zero.">CPU_Timer</a> timer;
145</pre></div><p>
146Actions: Reset: <div class="fragment"><pre class="fragment"> timer.reset();
147</pre></div> Start: <div class="fragment"><pre class="fragment"> timer.start();
148</pre></div> Stop: <div class="fragment"><pre class="fragment"> timer.stop();
149</pre></div> Get time: <div class="fragment"><pre class="fragment"> elapsedtime = timer.get_time();
150</pre></div><p>
151It is possible to get elapsed time without stopping the timer. Observe that it is also possible to use the macros "time.tic();" to reset and start clock and "time.toc();" stop and print the elapsed time. <dl class="warning" compact><dt><b>Warning:</b></dt><dd>May give an negative answer if the measured time is too long. </dd></dl>
152<hr>The documentation for this class was generated from the following files:<ul>
153<li><a class="el" href="timing_8h-source.html">timing.h</a><li><a class="el" href="timing_8cpp.html">timing.cpp</a></ul>
154</div>
155<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:19 2009 for mixpp by&nbsp;
156<a href="http://www.doxygen.org/index.html">
157<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
158</body>
159</html>
Note: See TracBrowser for help on using the browser.