aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/hierarchical__timer_8h-source.html
blob: be50c42c8ae4883c191dbad0b67386952b405f40 (plain)
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>hierarchical_timer.h</h1><a href="hierarchical__timer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2000, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NeL Network Services.</font>
00010 <font class="comment"> * NEVRAX NeL Network Services is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NeL Network Services is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NeL Network Services; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#ifndef NL_HIERARCHICAL_TIMER_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_HIERARCHICAL_TIMER_H</font>
00028 <font class="preprocessor"></font>
00029 <font class="preprocessor">#include &lt;string&gt;</font>
00030 <font class="preprocessor">#include &lt;vector&gt;</font>
00031 
00032 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="time__nl_8h.html">nel/misc/time_nl.h</a>"</font>
00034 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
00035 
00036 <font class="preprocessor">#include &lt;algorithm&gt;</font>
00037 
<a name="l00038"></a><a class="code" href="hierarchical__timer_8h.html#a0">00038</a> <font class="preprocessor">#define ALLOW_TIMING_MEASURES</font>
00039 <font class="preprocessor"></font>
00040 
00041 <font class="preprocessor">#ifdef ALLOW_TIMING_MEASURES</font>
00042 <font class="preprocessor"></font>        <font class="comment">// Several macros to use</font>
<a name="l00043"></a><a class="code" href="hierarchical__timer_8h.html#a1">00043</a> <font class="preprocessor">#       define H_TIME(name, inst) \</font>
00044 <font class="preprocessor">        { \</font>
00045 <font class="preprocessor">                static NLMISC::CHTimer  nl_h_timer(name); \</font>
00046 <font class="preprocessor">                nl_h_timer.before(); \</font>
00047 <font class="preprocessor">                inst \</font>
00048 <font class="preprocessor">                nl_h_timer.after(); \</font>
00049 <font class="preprocessor">        }</font>
00050 <font class="preprocessor"></font>        <font class="comment">//</font>
<a name="l00051"></a><a class="code" href="hierarchical__timer_8h.html#a2">00051</a> <font class="preprocessor">#       define H_BEFORE(__name) static NLMISC::CHTimer  __name##_timer(#__name); __name##_timer.before();</font>
<a name="l00052"></a><a class="code" href="hierarchical__timer_8h.html#a3">00052</a> <font class="preprocessor"></font><font class="preprocessor">#       define H_AFTER(__name)          __name##_timer.after();</font>
00053 <font class="preprocessor"></font>        <font class="comment">//</font>
<a name="l00054"></a><a class="code" href="hierarchical__timer_8h.html#a4">00054</a> <font class="preprocessor">#       define H_AUTO(__name)           static NLMISC::CHTimer  __name##_timer(#__name); NLMISC::CAutoTimer     __name##_auto(&amp;__name##_timer);</font>
00055 <font class="preprocessor"></font>        <font class="comment">// display the timer info after each loop call</font>
<a name="l00056"></a><a class="code" href="hierarchical__timer_8h.html#a5">00056</a> <font class="preprocessor">#       define H_AUTO_INST(__name)      static NLMISC::CHTimer  __name##_timer(#__name); NLMISC::CAutoTimer     __name##_auto(&amp;__name##_timer, true);</font>
00057 <font class="preprocessor"></font>
<a name="l00061"></a><a class="code" href="hierarchical__timer_8h.html#a6">00061</a> <font class="preprocessor">#       define H_AUTO_DECL(__name)              static NLMISC::CHTimer  __name##_timer(#__name); </font>
<a name="l00062"></a><a class="code" href="hierarchical__timer_8h.html#a7">00062</a> <font class="preprocessor"></font><font class="preprocessor">#       define H_AUTO_USE(__name)               NLMISC::CAutoTimer      __name##_auto(&amp;__name##_timer);</font>
00063 <font class="preprocessor"></font>
00064 <font class="preprocessor">#else</font>
00065 <font class="preprocessor"></font>        <font class="comment">// void macros</font>
00066 <font class="preprocessor">#       define H_TIME(name, inst)       </font>
00067 <font class="preprocessor"></font><font class="preprocessor">#       define H_BEFORE(__name)</font>
00068 <font class="preprocessor"></font><font class="preprocessor">#       define H_AFTER(__name)  </font>
00069 <font class="preprocessor"></font><font class="preprocessor">#       define H_AUTO(__name)   </font>
00070 <font class="preprocessor"></font><font class="preprocessor">#       define H_AUTO_INST(__name)</font>
00071 <font class="preprocessor"></font><font class="preprocessor">#       define H_AUTO_DECL(__name)</font>
00072 <font class="preprocessor"></font><font class="preprocessor">#       define H_AUTO_USE(__name)</font>
00073 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00074 <font class="preprocessor"></font>
00075 
00076 <font class="keyword">namespace </font>NLMISC
00077 {
00078 
00079 
00080 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
00081 <font class="preprocessor"></font><font class="comment">// Vicual C++ warning : ebp maybe modified</font>
00082 <font class="preprocessor">#       pragma warning(disable:4731)</font>
00083 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00084 <font class="preprocessor"></font>
00085 
00088 <font class="preprocessor">#ifdef NL_CPU_INTEL</font>
00089 <font class="preprocessor"></font>
00090 <font class="keyword">inline</font> uint64 rdtsc()
00091 {
00092         uint64 ticks;
00093 <font class="preprocessor">#       ifndef NL_OS_WINDOWS            </font>
00094 <font class="preprocessor"></font>                __asm__ <font class="keyword">volatile</font>(<font class="stringliteral">".byte 0x0f, 0x31"</font> : <font class="stringliteral">"=a"</font> (ticks.low), <font class="stringliteral">"=d"</font> (ticks.high));                             
00095 <font class="preprocessor">#       else            </font>
00096 <font class="preprocessor"></font>                __asm   rdtsc
00097                 __asm   mov             DWORD PTR [ticks], eax
00098                 __asm   mov             DWORD PTR [ticks + 4], edx              
00099 <font class="preprocessor">#       endif</font>
00100 <font class="preprocessor"></font>        <font class="keywordflow">return</font> ticks;   
00101 }
00102 
00103 <font class="preprocessor">#endif  </font>
00104 <font class="preprocessor"></font>
00105 
<a name="l00114"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html">00114</a> <font class="keyword">class </font>CSimpleClock
00115 {
00116 <font class="keyword">public</font>: 
<a name="l00117"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html#a0">00117</a>         <a class="code" href="classNLMISC_1_1CSimpleClock.html#a0">CSimpleClock</a>() : <a class="code" href="classNLMISC_1_1CSimpleClock.html#o1">_NumTicks</a>(0)
00118         {
00119 <font class="preprocessor">#               ifdef NL_DEBUG</font>
00120 <font class="preprocessor"></font>                        _Started = <font class="keyword">false</font>;
00121 <font class="preprocessor">#               endif</font>
00122 <font class="preprocessor"></font>        }
00123         <font class="comment">// start measure</font>
<a name="l00124"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html#a1">00124</a>         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CSimpleClock.html#a1">start</a>()
00125         {
00126 <font class="preprocessor">#               ifdef  NL_DEBUG</font>
00127 <font class="preprocessor"></font>                        <a class="code" href="debug_8h.html#a6">nlassert</a>(!_Started);
00128                         _Started = <font class="keyword">true</font>;
00129 <font class="preprocessor">#               endif</font>
00130 <font class="preprocessor"></font><font class="preprocessor">#               ifdef NL_CPU_INTEL</font>
00131 <font class="preprocessor"></font>                <a class="code" href="classNLMISC_1_1CSimpleClock.html#o0">_StartTick</a> = rdtsc();
00132 <font class="preprocessor">#               else</font>
00133 <font class="preprocessor"></font>                <a class="code" href="classNLMISC_1_1CSimpleClock.html#o0">_StartTick</a> = CTime::getPerformanceTime();
00134 <font class="preprocessor">#               endif</font>
00135 <font class="preprocessor"></font>        }
00136         <font class="comment">// end measure</font>
<a name="l00137"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html#a2">00137</a>         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CSimpleClock.html#a2">stop</a>()
00138         {
00139 <font class="preprocessor">#               ifdef  NL_DEBUG</font>
00140 <font class="preprocessor"></font>                        <a class="code" href="debug_8h.html#a6">nlassert</a>(_Started);
00141                         _Started = <font class="keyword">false</font>;
00142 <font class="preprocessor">#               endif</font>
00143 <font class="preprocessor"></font><font class="preprocessor">#               ifdef NL_CPU_INTEL</font>
00144 <font class="preprocessor"></font>                <a class="code" href="classNLMISC_1_1CSimpleClock.html#o1">_NumTicks</a> = rdtsc() - <a class="code" href="classNLMISC_1_1CSimpleClock.html#o0">_StartTick</a>;
00145 <font class="preprocessor">#               else</font>
00146 <font class="preprocessor"></font>                <a class="code" href="classNLMISC_1_1CSimpleClock.html#o1">_NumTicks</a> = CTime::getPerformanceTime() - <a class="code" href="classNLMISC_1_1CSimpleClock.html#o0">_StartTick</a>;
00147 <font class="preprocessor">#               endif</font>
00148 <font class="preprocessor"></font>                
00149         }       
00150         <font class="comment">// get measure</font>
<a name="l00151"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html#a3">00151</a>         uint64  <a class="code" href="classNLMISC_1_1CSimpleClock.html#a3">getNumTicks</a>()<font class="keyword"> const</font>
00152 <font class="keyword">        </font>{
00153 <font class="preprocessor">                #ifdef NL_DEBUG</font>
00154 <font class="preprocessor"></font>                        <a class="code" href="debug_8h.html#a6">nlassert</a>(!_Started);
00155 <font class="preprocessor">                #endif</font>
00156 <font class="preprocessor"></font>                <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNLMISC_1_1CSimpleClock.html#o1">_NumTicks</a> != 0);
00157                 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CSimpleClock.html#o1">_NumTicks</a>;
00158         }       
00159         <font class="comment">// This compute the duration of start and stop (in cycles).</font>
00160         <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CSimpleClock.html#d0">init</a>();
<a name="l00164"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html#d1">00164</a>         <font class="keyword">static</font> uint64 <a class="code" href="classNLMISC_1_1CSimpleClock.html#d1">getStartStopNumTicks</a>() 
00165         {               
00166                 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CSimpleClock.html#r1">_StartStopNumTicks</a>; 
00167         }       
00168 <font class="keyword">private</font>:
<a name="l00169"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html#o0">00169</a>         uint64  <a class="code" href="classNLMISC_1_1CSimpleClock.html#o0">_StartTick</a>;
<a name="l00170"></a><a class="code" href="classNLMISC_1_1CSimpleClock.html#o1">00170</a>         uint64  <a class="code" href="classNLMISC_1_1CSimpleClock.html#o1">_NumTicks</a>;
00171 <font class="preprocessor">#       ifdef  NL_DEBUG</font>
00172 <font class="preprocessor"></font>                <font class="keywordtype">bool</font>    _Started;
00173 <font class="preprocessor">#       endif</font>
00174 <font class="preprocessor"></font>        <font class="keyword">static</font> <font class="keywordtype">bool</font>             <a class="code" href="classNLMISC_1_1CSimpleClock.html#r0">_InitDone</a>;
00175         <font class="keyword">static</font> uint64   <a class="code" href="classNLMISC_1_1CSimpleClock.html#r1">_StartStopNumTicks</a>;     
00176 };
00177 
00178 
00179 
00180 
00181 
<a name="l00205"></a><a class="code" href="classNLMISC_1_1CHTimer.html">00205</a> <font class="keyword">class </font>CHTimer
00206 {
00207 <font class="keyword">public</font>:
00208         <font class="comment">// this enum is used to sort displayed results</font>
<a name="l00209"></a><a class="code" href="classNLMISC_1_1CHTimer.html#s8">00209</a>         <font class="keyword">enum</font> <a class="code" href="classNLMISC_1_1CHTimer.html#s8">TSortCriterion</a> { <a class="code" href="classNLMISC_1_1CHTimer.html#s8s0">NoSort</a>, 
00210                                                   <a class="code" href="classNLMISC_1_1CHTimer.html#s8s1">TotalTime</a>,
00211                                                   <a class="code" href="classNLMISC_1_1CHTimer.html#s8s2">TotalTimeWithoutSons</a>,
00212                                                   <a class="code" href="classNLMISC_1_1CHTimer.html#s8s3">MeanTime</a>,
00213                                                   <a class="code" href="classNLMISC_1_1CHTimer.html#s8s4">NumVisits</a>,
00214                                                   <a class="code" href="classNLMISC_1_1CHTimer.html#s8s5">MaxTime</a>,
00215                                                   <a class="code" href="classNLMISC_1_1CHTimer.html#s8s6">MinTime</a>,
00216                                                   <a class="code" href="classNLMISC_1_1CHTimer.html#s8s7">SortCriterionsLast</a>
00217                                                 };
00218 <font class="keyword">public</font>:
<a name="l00220"></a><a class="code" href="classNLMISC_1_1CHTimer.html#a0">00220</a>         <a class="code" href="classNLMISC_1_1CHTimer.html#a0">CHTimer</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *name, <font class="keywordtype">bool</font> isRoot = <font class="keyword">false</font>) : <a class="code" href="classNLMISC_1_1CHTimer.html#o0">_Name</a>(name), <a class="code" href="classNLMISC_1_1CHTimer.html#o3">_IsRoot</a>(isRoot) {}
00222         <font class="keywordtype">void</font>            <a class="code" href="classNLMISC_1_1CHTimer.html#a1">before</a>();
00223         <font class="comment">// Ends a measuring session</font>
00224         <font class="keywordtype">void</font>            <a class="code" href="classNLMISC_1_1CHTimer.html#a2">after</a>(<font class="keywordtype">bool</font> displayAfter = <font class="keyword">false</font>);       
00225         <font class="comment">// Get this node name</font>
<a name="l00226"></a><a class="code" href="classNLMISC_1_1CHTimer.html#a3">00226</a>         <font class="keyword">const</font> <font class="keywordtype">char</font>         *<a class="code" href="classNLMISC_1_1CHTimer.html#a3">getName</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CHTimer.html#o0">_Name</a>; }
00231         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d0">startBench</a>(<font class="keywordtype">bool</font> wantStandardDeviation = <font class="keyword">false</font>, <font class="keywordtype">bool</font> quick = <font class="keyword">false</font>);
<a name="l00234"></a><a class="code" href="classNLMISC_1_1CHTimer.html#d1">00234</a>         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d1">bench</a>() { <a class="code" href="classNLMISC_1_1CHTimer.html#d0">startBench</a>(); }
<a name="l00237"></a><a class="code" href="classNLMISC_1_1CHTimer.html#d2">00237</a>         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d2">adjust</a>() {}
00239         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d3">endBench</a>();
00243         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d4">display</a>(CLog *log= <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, <a class="code" href="classNLMISC_1_1CHTimer.html#s8">TSortCriterion</a> criterion = <a class="code" href="classNLMISC_1_1CHTimer.html#s8s1">TotalTime</a>, <font class="keywordtype">bool</font> displayInline = <font class="keyword">true</font>, <font class="keywordtype">bool</font> displayEx = <font class="keyword">true</font>);
00249         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d5">displayByExecutionPath</a>(CLog *log= <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, <a class="code" href="classNLMISC_1_1CHTimer.html#s8">TSortCriterion</a> criterion = <a class="code" href="classNLMISC_1_1CHTimer.html#s8s1">TotalTime</a>, <font class="keywordtype">bool</font> displayInline = <font class="keyword">true</font>, <font class="keywordtype">bool</font> alignPaths = <font class="keyword">true</font>, <font class="keywordtype">bool</font> displayEx = <font class="keyword">true</font>);
00250 
00255         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d6">displayHierarchical</a>(CLog *log= <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, <font class="keywordtype">bool</font> displayEx = <font class="keyword">true</font>, uint labelNumChar = 32, uint indentationStep = 2);
00256 
00261         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d7">displayHierarchicalByExecutionPath</a>(CLog *log= <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, <font class="keywordtype">bool</font> displayEx = <font class="keyword">true</font>, uint labelNumChar = 32, uint indentationStep = 2);
00262 
00267         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d8">displayHierarchicalByExecutionPathSorted</a>(CLog *log= <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, <a class="code" href="classNLMISC_1_1CHTimer.html#s8">TSortCriterion</a> criterion = <a class="code" href="classNLMISC_1_1CHTimer.html#s8s1">TotalTime</a>, <font class="keywordtype">bool</font> displayEx = <font class="keyword">true</font>, uint labelNumChar = 32, uint indentationStep = 2);
00268 
00270         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CHTimer.html#d9">clear</a>();                
00271 
00276 <font class="preprocessor">#ifdef NL_CPU_INTEL</font>
00277 <font class="preprocessor"></font>        <font class="keyword">static</font> uint64   getProcessorFrequency(<font class="keywordtype">bool</font> quick=<font class="keyword">false</font>);
00278 <font class="preprocessor">#endif</font>
00281 <font class="preprocessor">private:</font>
00282 <font class="preprocessor"></font>        <font class="keyword">struct </font>CNode;
<a name="l00283"></a><a class="code" href="classNLMISC_1_1CHTimer.html#u0">00283</a>         <font class="keyword">typedef</font> std::vector&lt;CNode *&gt;   <a class="code" href="classNLMISC_1_1CHTimer.html#u0">TNodeVect</a>;
<a name="l00284"></a><a class="code" href="classNLMISC_1_1CHTimer.html#u1">00284</a>         <font class="keyword">typedef</font> std::vector&lt;CHTimer *&gt; <a class="code" href="classNLMISC_1_1CHTimer.html#u1">TTimerVect</a>;
00285         <font class="comment">//</font>
<a name="l00287"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html">00287</a> <font class="comment">        struct CNode</font>
00288         {               
<a name="l00289"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#s0">00289</a>                 <font class="keyword">typedef</font> std::vector&lt;double&gt; TTimeVect;
00290                 <font class="comment">//</font>
<a name="l00291"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m0">00291</a>                 CNode                                   *Parent;
<a name="l00292"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m1">00292</a>                 <a class="code" href="classNLMISC_1_1CHTimer.html#u0">TNodeVect</a>                               Sons;
<a name="l00293"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m2">00293</a>                 <a class="code" href="classNLMISC_1_1CHTimer.html#a0">CHTimer</a>                                 *Owner;    <font class="comment">// the hierarchical timer this node is associated with               </font>
<a name="l00294"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m3">00294</a>                 uint64                                  <a class="code" href="classNLMISC_1_1CHTimer.html#s8s1">TotalTime</a>; <font class="comment">// the total time spent in that node, including sons         </font>
<a name="l00295"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m4">00295</a>                 uint64                                  LastSonsTotalTime; 
<a name="l00296"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m5">00296</a>                 uint64                                  SonsTotalTime; <font class="comment">// maybe different from LastSonsTotalTime while benching the sons and if the display is called in a benched node</font>
<a name="l00297"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m6">00297</a>                 TTimeVect                               Measures;  <font class="comment">// All time measures. Used only when standard deviation is wanted</font>
<a name="l00298"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m7">00298</a>                 uint64                                  <a class="code" href="classNLMISC_1_1CHTimer.html#s8s6">MinTime</a>;   <font class="comment">// the minimum time spent in that node</font>
<a name="l00299"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m8">00299</a>                 uint64                                  <a class="code" href="classNLMISC_1_1CHTimer.html#s8s5">MaxTime</a>;   <font class="comment">// the maximum time spent in that node</font>
<a name="l00300"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m9">00300</a>                 uint64                                  <a class="code" href="classNLMISC_1_1CHTimer.html#s8s4">NumVisits</a>; <font class="comment">// the number of time the execution has gone through this node               </font>
00301                 <font class="comment">//</font>
<a name="l00302"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m10">00302</a>                 uint64                                  SonsPreambule; <font class="comment">// preambule time for the sons           </font>
<a name="l00303"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#m11">00303</a>                 CSimpleClock                    Clock;         <font class="comment">// a clock to do the measures at this node</font>
00304                 <font class="comment">// ctor </font>
<a name="l00305"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#a0">00305</a>           CNode(<a class="code" href="classNLMISC_1_1CHTimer.html#a0">CHTimer</a> *owner = NULL, CNode    *parent = NULL) : Parent(parent), Owner(owner)
00306                 {
00307                         reset();
00308                 }
00309                 <font class="comment">// dtor</font>
00310                 ~CNode();
00311                 <font class="comment">// Get the number of nodes in the tree starting at this node</font>
00312                 uint  getNumNodes() <font class="keyword">const</font>;
00313                 <font class="comment">// release the sons, should not be benching when calling this</font>
00314                 <font class="keywordtype">void</font>    releaseSons();
00315                 <font class="comment">// reset this node measures</font>
<a name="l00316"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNode.html#a4">00316</a>                 <font class="keywordtype">void</font>    reset()
00317                 {
00318                         SonsTotalTime            = 0;
00319                         <a class="code" href="classNLMISC_1_1CHTimer.html#s8s1">TotalTime</a>                        = 0;
00320                         <a class="code" href="classNLMISC_1_1CHTimer.html#s8s5">MaxTime</a>                          = 0;
00321                         <a class="code" href="classNLMISC_1_1CHTimer.html#s8s6">MinTime</a>                          = (uint64) -1;
00322                         <a class="code" href="classNLMISC_1_1CHTimer.html#s8s4">NumVisits</a>                        = 0;
00323                         SonsPreambule        = 0;                       
00324                         LastSonsTotalTime    = 0;
00325                         <a class="code" href="namespaceNLMISC.html#a222">NLMISC::contReset</a>(Measures);
00326                 }
00327                 <font class="comment">// Display this node path</font>
00328                 <font class="keywordtype">void</font>    displayPath(CLog *log) <font class="keyword">const</font>;
00329                 <font class="comment">// Get this node path</font>
00330                 <font class="keywordtype">void</font>    getPath(std::string &amp;dest) <font class="keyword">const</font>;               
00331         };
00332 
<a name="l00336"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html">00336</a>         <font class="keyword">struct </font>CStats
00337         {       
<a name="l00338"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m0">00338</a>                 <font class="keywordtype">double</font>  <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m0">TimeStandardDeviation</a>;
<a name="l00339"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m1">00339</a>                 <font class="keywordtype">double</font>  <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m1">TotalTime</a>;              
<a name="l00340"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m2">00340</a>                 <font class="keywordtype">double</font>  <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m2">TotalTimeWithoutSons</a>;
<a name="l00341"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m3">00341</a>                 <font class="keywordtype">double</font>  <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m3">MeanTime</a>;
<a name="l00342"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m4">00342</a>                 uint64  <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m4">NumVisits</a>;
<a name="l00343"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m5">00343</a>                 <font class="keywordtype">double</font>  <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m5">MinTime</a>;
<a name="l00344"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m6">00344</a>                 <font class="keywordtype">double</font>  <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#m6">MaxTime</a>;                
00345 
00346                 <font class="comment">// build stats from a single node</font>
00347                 <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#a0">buildFromNode</a>(CNode *node, <font class="keywordtype">double</font> msPerTick);
00348                 
00349                 <font class="comment">// build stats from a vector of nodes</font>
00350                 <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#a1">buildFromNodes</a>(CNode **firstNode, uint numNodes, <font class="keywordtype">double</font> msPerTick);
00351 
00352                 <font class="comment">// display stats</font>
00353                 <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#a2">display</a>(CLog *log, <font class="keywordtype">bool</font> displayEx = <font class="keyword">false</font>, <font class="keywordtype">bool</font> wantStandardDeviation = <font class="keyword">false</font>);
00354 
00358                 <font class="keywordtype">void</font> <a class="code" href="structNLMISC_1_1CHTimer_1_1CStats.html#a3">getStats</a>(std::string &amp;dest, <font class="keywordtype">bool</font> statEx, <font class="keywordtype">double</font> rootTotalTime, <font class="keywordtype">bool</font> wantStandardDeviation = <font class="keyword">false</font>);
00359         };
00360         <font class="comment">// Stats and the associated timer</font>
<a name="l00361"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CTimerStat.html">00361</a>         <font class="keyword">struct </font>CTimerStat : <font class="keyword">public</font> CStats
00362         {
<a name="l00363"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CTimerStat.html#m0">00363</a>                 CHTimer *<a class="code" href="structNLMISC_1_1CHTimer_1_1CTimerStat.html#m0">Timer</a>;                 
00364         };
00365         <font class="comment">// Stats and the associated node</font>
<a name="l00366"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNodeStat.html">00366</a>         <font class="keyword">struct </font>CNodeStat : <font class="keyword">public</font> CStats
00367         {
<a name="l00368"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CNodeStat.html#m0">00368</a>                 CNode *<a class="code" href="structNLMISC_1_1CHTimer_1_1CNodeStat.html#m0">Node</a>;
00369         };      
00370 
00371 
<a name="l00375"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStatSorter.html">00375</a>         <font class="keyword">struct </font>CStatSorter
00376         {
<a name="l00377"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStatSorter.html#a0">00377</a>                 <a class="code" href="structNLMISC_1_1CHTimer_1_1CStatSorter.html#a0">CStatSorter</a>(TSortCriterion criterion = TotalTime) : <a class="code" href="structNLMISC_1_1CHTimer_1_1CStatSorter.html#m0">Criterion</a>(criterion)
00378                 {}
<a name="l00379"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CStatSorter.html#m0">00379</a>                 TSortCriterion <a class="code" href="structNLMISC_1_1CHTimer_1_1CStatSorter.html#m0">Criterion</a>;
00380                 <font class="comment">// Less operator</font>
00381                 <font class="keywordtype">bool</font> <a class="code" href="structNLMISC_1_1CHTimer_1_1CStatSorter.html#a1">operator()</a>(<font class="keyword">const</font> CStats *lhs, <font class="keyword">const</font> CStats *rhs);
00382         };
00383 
00384 
<a name="l00388"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html">00388</a>         <font class="keyword">struct  </font>CExamStackEntry
00389         {
00390                 <font class="comment">// The node.</font>
<a name="l00391"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m0">00391</a>                 CNode                           *<a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m0">Node</a>;
00392                 <font class="comment">// The current child to process.</font>
<a name="l00393"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m1">00393</a>                 uint                            <a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m1">CurrentChild</a>;
00394                 <font class="comment">// The childs, sorted by specific criterion.</font>
<a name="l00395"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m2">00395</a>                 std::vector&lt;CNode*&gt;     <a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m2">Children</a>;
00396 
<a name="l00397"></a><a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#a0">00397</a>                 <font class="keyword">explicit</font>        <a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#a0">CExamStackEntry</a>(CNode *node)
00398                 {
00399                         <a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m0">Node</a>= node;
00400                         <a class="code" href="structNLMISC_1_1CHTimer_1_1CExamStackEntry.html#m1">CurrentChild</a>= 0;
00401                 }
00402         };
00403 
00404 
00405 <font class="keyword">private</font>:
00406         <font class="comment">// walk the tree to current execution node, creating it if necessary</font>
00407         <font class="keywordtype">void</font>    <a class="code" href="classNLMISC_1_1CHTimer.html#c0">walkTreeToCurrent</a>();
00408 <font class="keyword">private</font>:
00409         <font class="comment">// node name</font>
<a name="l00410"></a><a class="code" href="classNLMISC_1_1CHTimer.html#o0">00410</a>         <font class="keyword">const</font>  <font class="keywordtype">char</font>                                             *<a class="code" href="classNLMISC_1_1CHTimer.html#o0">_Name</a>;
00411         <font class="comment">// the parent timer</font>
<a name="l00412"></a><a class="code" href="classNLMISC_1_1CHTimer.html#o1">00412</a>         <a class="code" href="classNLMISC_1_1CHTimer.html#a0">CHTimer</a>                                                 *<a class="code" href="classNLMISC_1_1CHTimer.html#o1">_Parent</a>;
00413         <font class="comment">// the sons timers</font>
<a name="l00414"></a><a class="code" href="classNLMISC_1_1CHTimer.html#o2">00414</a>         <a class="code" href="classNLMISC_1_1CHTimer.html#u1">TTimerVect</a>                                              <a class="code" href="classNLMISC_1_1CHTimer.html#o2">_Sons</a>;
00415         <font class="comment">// Tells if this is a root node</font>
<a name="l00416"></a><a class="code" href="classNLMISC_1_1CHTimer.html#o3">00416</a>         <font class="keywordtype">bool</font>                                                    <a class="code" href="classNLMISC_1_1CHTimer.html#o3">_IsRoot</a>;
00417 <font class="keyword">private</font>:
00418         <font class="comment">// root node of the hierarchy</font>
00419         <font class="keyword">static</font> CNode                                    <a class="code" href="classNLMISC_1_1CHTimer.html#r0">_RootNode</a>;
00420         <font class="comment">// the current node of the execution</font>
00421         <font class="keyword">static</font> CNode                                    *<a class="code" href="classNLMISC_1_1CHTimer.html#r1">_CurrNode</a>;     
00422         <font class="comment">// the root timer</font>
00423         <font class="keyword">static</font> <a class="code" href="classNLMISC_1_1CHTimer.html#a0">CHTimer</a>                                   <a class="code" href="classNLMISC_1_1CHTimer.html#r2">_RootTimer</a>;
00427         <font class="keyword">static</font> CSimpleClock                             <a class="code" href="classNLMISC_1_1CHTimer.html#r3">_PreambuleClock</a>;
00428         <font class="comment">//</font>
00429         <font class="keyword">static</font> <font class="keywordtype">double</font>                                   <a class="code" href="classNLMISC_1_1CHTimer.html#r4">_MsPerTick</a>;
00430         <font class="comment">//</font>
00431         <font class="keyword">static</font> <font class="keywordtype">bool</font>                                             <a class="code" href="classNLMISC_1_1CHTimer.html#r5">_Benching</a>;
00432         <font class="comment">//</font>
00433         <font class="keyword">static</font> <font class="keywordtype">bool</font>                                             <a class="code" href="classNLMISC_1_1CHTimer.html#r6">_BenchStartedOnce</a>;
00434         <font class="comment">//</font>
00435         <font class="keyword">static</font> <font class="keywordtype">bool</font>                                             <a class="code" href="classNLMISC_1_1CHTimer.html#r7">_WantStandardDeviation</a>;
00436         <font class="comment">//</font>
00437         <font class="keyword">static</font> <a class="code" href="classNLMISC_1_1CHTimer.html#a0">CHTimer</a>                             *<a class="code" href="classNLMISC_1_1CHTimer.html#r8">_CurrTimer</a>; 
00438 
00439 };
00440 
00441 
00442 
<a name="l00459"></a><a class="code" href="classNLMISC_1_1CAutoTimer.html">00459</a> <font class="keyword">class </font>CAutoTimer
00460 {
00461 <font class="keyword">private</font>:
<a name="l00462"></a><a class="code" href="classNLMISC_1_1CAutoTimer.html#o0">00462</a>         CHTimer         *<a class="code" href="classNLMISC_1_1CAutoTimer.html#o0">_HTimer</a>;
<a name="l00463"></a><a class="code" href="classNLMISC_1_1CAutoTimer.html#o1">00463</a>         <font class="keywordtype">bool</font>            <a class="code" href="classNLMISC_1_1CAutoTimer.html#o1">_DisplayAfter</a>;
00464 <font class="keyword">public</font>:
<a name="l00465"></a><a class="code" href="classNLMISC_1_1CAutoTimer.html#a0">00465</a>         <a class="code" href="classNLMISC_1_1CAutoTimer.html#a0">CAutoTimer</a>(CHTimer *timer, <font class="keywordtype">bool</font> displayAfter=<font class="keyword">false</font>) : _HTimer(timer), <a class="code" href="classNLMISC_1_1CAutoTimer.html#o1">_DisplayAfter</a>(displayAfter) { _HTimer-&gt;before(); }
<a name="l00466"></a><a class="code" href="classNLMISC_1_1CAutoTimer.html#a1">00466</a>         <a class="code" href="classNLMISC_1_1CAutoTimer.html#a1">~CAutoTimer</a>() { _HTimer-&gt;after(<a class="code" href="classNLMISC_1_1CAutoTimer.html#o1">_DisplayAfter</a>); }
00467 };
00468 
00469 
00471 <font class="comment">// inlines implementation //</font>
00473 <font class="comment">#if 0</font>
00474 <font class="comment">//===============================================</font>
00475 <font class="keyword">inline</font> <font class="keywordtype">void</font>     CHTimer::before()
00476 {       
00477         <font class="keywordflow">if</font> (!_Benching) <font class="keywordflow">return</font>;
00478         _PreambuleClock.start();
00479         walkTreeToCurrent();                    
00480         ++ _CurrNode-&gt;NumVisits;
00481         _CurrNode-&gt;SonsPreambule = 0;
00482         <font class="keywordflow">if</font> (!_Parent &amp;&amp; _CurrTimer != <font class="keyword">this</font>)
00483         {
00484                 _Parent = _CurrTimer;
00485                 <font class="comment">// register as a son of the parent</font>
00486                 _Parent-&gt;_Sons.push_back(<font class="keyword">this</font>); 
00487         }
00488         _CurrTimer = <font class="keyword">this</font>;
00489         _PreambuleClock.stop();
00490         <font class="keywordflow">if</font> (_CurrNode-&gt;Parent)
00491         {       
00492                 _CurrNode-&gt;Parent-&gt;SonsPreambule += _PreambuleClock.getNumTicks();
00493         }
00494         _CurrNode-&gt;Clock.start();
00495 }
00496 
00497 <font class="comment">//===============================================</font>
00498 <font class="keyword">inline</font> <font class="keywordtype">void</font>     CHTimer::after(<font class="keywordtype">bool</font> displayAfter <font class="comment">/*= false*/</font>)
00499 {
00500         <font class="keywordflow">if</font> (!_Benching) <font class="keywordflow">return</font>;
00501         _CurrNode-&gt;Clock.stop();                
00502         _PreambuleClock.start();
00503         <font class="comment">//              </font>
00504         <font class="comment">//nlinfo((std::string("clock ") + _Name + std::string(" time = ") + NLMISC::toString(_CurrNode-&gt;Clock.getNumTicks())).c_str());</font>
00505         uint64 numTicks = _CurrNode-&gt;Clock.getNumTicks()  - _CurrNode-&gt;SonsPreambule - (CSimpleClock::getStartStopNumTicks() &lt;&lt; 1);
00506 
00507         _CurrNode-&gt;TotalTime += numTicks;               
00508         _CurrNode-&gt;MinTime = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(_CurrNode-&gt;MinTime, numTicks);
00509         _CurrNode-&gt;MaxTime = std::max(_CurrNode-&gt;MaxTime, numTicks);
00510         _CurrNode-&gt;LastSonsTotalTime = _CurrNode-&gt;SonsTotalTime;
00511         <font class="keywordflow">if</font> (displayAfter)
00512         {               
00513                 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"FEHTIMER&gt; %s %.3fms loop number %d"</font>, _Name, numTicks * _MsPerTick, _CurrNode-&gt;NumVisits);
00514         }
00515         <font class="comment">//</font>
00516         <font class="keywordflow">if</font> (_WantStandardDeviation)
00517         {
00518                 _CurrNode-&gt;Measures.push_back(numTicks * _MsPerTick);
00519         }
00520         <font class="comment">//</font>
00521         <font class="keywordflow">if</font> (_Parent)
00522         {
00523                 _CurrTimer = _Parent;
00524         }       
00525         <font class="comment">//</font>
00526         <font class="keywordflow">if</font> (_CurrNode-&gt;Parent)
00527         {
00528                 _PreambuleClock.stop();
00529                 _CurrNode = _CurrNode-&gt;Parent;
00530                 _CurrNode-&gt;SonsTotalTime += numTicks;
00531                 _CurrNode-&gt;SonsPreambule += _PreambuleClock.getNumTicks();
00532         }
00533         <font class="keywordflow">else</font>
00534         {
00535                 _PreambuleClock.stop();
00536         }
00537 }
00538 <font class="preprocessor">#endif</font>
00539 <font class="preprocessor"></font>
00540 } <font class="comment">// NLMISC</font>
00541 
00542 <font class="preprocessor">#endif // NL_HIERARCHICAL_TIMER_H</font>
00543 <font class="preprocessor"></font>
00544 <font class="comment">/* End of hierarchical_timer.h */</font>
00545 
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>