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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Passenger: Passenger::Timer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacePassenger.html">Passenger</a>::<a class="el" href="classPassenger_1_1Timer.html">Timer</a>
</div>
</div>
<div class="contents">
<h1>Passenger::Timer Class Reference</h1><!-- doxytag: class="Passenger::Timer" -->A <a class="el" href="classPassenger_1_1Timer.html" title="A Timer which one can use to check how much time has elapsed since the timer started...">Timer</a> which one can use to check how much time has elapsed since the timer started.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="Timer_8h-source.html">Timer.h</a>></code>
<p>
<p>
<a href="classPassenger_1_1Timer-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Timer.html#6be9070c1a2d0a9abbd98a1a90f916c6">Timer</a> (bool startNow=true)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new <a class="el" href="classPassenger_1_1Timer.html" title="A Timer which one can use to check how much time has elapsed since the timer started...">Timer</a> object. <a href="#6be9070c1a2d0a9abbd98a1a90f916c6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Timer.html#3808e3b519b4d59894ae3390bc19e7a5">start</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Start the timer. <a href="#3808e3b519b4d59894ae3390bc19e7a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Timer.html#15aadf8f5b520c18ccd87b9d2bc7e063">stop</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Stop the timer. <a href="#15aadf8f5b520c18ccd87b9d2bc7e063"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned long long </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Timer.html#b65b046b385b6d964f685ada320fe5f2">elapsed</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the amount of time that has elapsed since the timer was last started, in miliseconds. <a href="#b65b046b385b6d964f685ada320fe5f2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="5f8667ebab3890ddc412b2086dbec14c"></a><!-- doxytag: member="Passenger::Timer::wait" ref="5f8667ebab3890ddc412b2086dbec14c" args="(unsigned long long time) const " -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Timer.html#5f8667ebab3890ddc412b2086dbec14c">wait</a> (unsigned long long time) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Wait until <em>time</em> miliseconds have elapsed since the timer was last started. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A <a class="el" href="classPassenger_1_1Timer.html" title="A Timer which one can use to check how much time has elapsed since the timer started...">Timer</a> which one can use to check how much time has elapsed since the timer started.
<p>
This timer support miliseconds-resolution, but the exact resolution depends on the OS and the hardware.<p>
This class is thread-safe.<p>
<div class="fragment"><pre class="fragment"> <a class="code" href="classPassenger_1_1Timer.html#6be9070c1a2d0a9abbd98a1a90f916c6" title="Creates a new Timer object.">Timer</a> timer;
sleep(10);
timer.elapsed(); <span class="comment">// => about 10000 (msec)</span>
</pre></div> <hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="6be9070c1a2d0a9abbd98a1a90f916c6"></a><!-- doxytag: member="Passenger::Timer::Timer" ref="6be9070c1a2d0a9abbd98a1a90f916c6" args="(bool startNow=true)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Passenger::Timer::Timer </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>startNow</em> = <code>true</code> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new <a class="el" href="classPassenger_1_1Timer.html" title="A Timer which one can use to check how much time has elapsed since the timer started...">Timer</a> object.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>startNow</em> </td><td>Whether the timer should be started immediately. </td></tr>
</table>
</dl>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="b65b046b385b6d964f685ada320fe5f2"></a><!-- doxytag: member="Passenger::Timer::elapsed" ref="b65b046b385b6d964f685ada320fe5f2" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned long long Passenger::Timer::elapsed </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the amount of time that has elapsed since the timer was last started, in miliseconds.
<p>
If the timer is currently stopped, then 0 is returned.
</div>
</div><p>
<a class="anchor" name="3808e3b519b4d59894ae3390bc19e7a5"></a><!-- doxytag: member="Passenger::Timer::start" ref="3808e3b519b4d59894ae3390bc19e7a5" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::Timer::start </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Start the timer.
<p>
If the timer was already started, then this will restart the timer.
</div>
</div><p>
<a class="anchor" name="15aadf8f5b520c18ccd87b9d2bc7e063"></a><!-- doxytag: member="Passenger::Timer::stop" ref="15aadf8f5b520c18ccd87b9d2bc7e063" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::Timer::stop </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Stop the timer.
<p>
If there's currently another thread waiting on the <a class="el" href="classPassenger_1_1Timer.html#5f8667ebab3890ddc412b2086dbec14c" title="Wait until time miliseconds have elapsed since the timer was last started.">wait()</a> call, then that <a class="el" href="classPassenger_1_1Timer.html#5f8667ebab3890ddc412b2086dbec14c" title="Wait until time miliseconds have elapsed since the timer was last started.">wait()</a> call will block indefinitely until you call <a class="el" href="classPassenger_1_1Timer.html#3808e3b519b4d59894ae3390bc19e7a5" title="Start the timer.">start()</a> and sufficient amount of time has elapsed.
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Timer_8h-source.html">Timer.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Feb 8 22:53:23 2010 for Passenger by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>
|