One would need to check but other things are important. For example, do the timers encompass the time during which clang/llvm read/write files (not even parsing them but just open/read/write/close) ?<br><br>As a matter of fact, on linux, llvm obtains time statistics with gettimeofday which has an unspecified precision. So it's hard to compare with time which gives you the time reported by the kernel.<br>

I would say that if you want the total time need by the process, pick the one of 'time', if you need the time per phase, then pick the one of the output and use relative figures only (percentage of the total time).<br>

<br clear="all">Amaury Pouly<br>
<br><br><div class="gmail_quote">2010/8/5 Argyrios Kyrtzidis <span dir="ltr"><<a href="mailto:kyrtzidis@apple.com">kyrtzidis@apple.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div style="word-wrap: break-word;"><div><div class="im"><div>On 5 Aug 2010, at 14:37, Amaury Pouly wrote:</div><br><blockquote type="cite">That can be due to lots of things. Just consider this difference:<br>- Wall time: preception of time form the user. That is, if you run your program at time T and it ends at time T+D, then the wall time is D normally<br>

- Processor time: time allocated on the processor, which can even be greater than the wall time if the program uses several processors (if you have two processors, you can in theory use 2*D processor time for a wall time of D).<br>



<br>I don't know how the times are computed but it could be related to these points. And perhaps the time needed to do all the initialisation and loading of the executable is counted somewhere.<br></blockquote><div><br>

</div></div><div>Yes but the difference between the 'time' utility and the internal timers is not constant, with '-fsyntax-only' the internal timers report lower numbers but with '-emit-llvm-bc' they report higher ones.</div>

<div><br></div><div>In general is 'time' utility the more reliable one ?</div><div><br></div><div>-Argiris</div><div><div></div><div class="h5"><br><blockquote type="cite"><br clear="all">Amaury Pouly<br>


<br><br><div class="gmail_quote">2010/8/5 Argyrios Kyrtzidis <span dir="ltr"><<a href="mailto:kyrtzidis@apple.com" target="_blank">kyrtzidis@apple.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



<div style="word-wrap: break-word;">Hi,<div><br></div><div>When I try '-ftime-report' the numbers differ from 'time', either higher or lower, e.g:</div><div><br></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">> time clang -cc1 lib/VMCore/Dominators.cpp -Iinclude -Ilib/VMCore -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -ftime-report -emit-llvm-bc -o t.o</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">[LLVM pass timers]</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br>



</span></font></div><div><div><font face="Monaco" size="3"><span style="font-size: 11px;">===-------------------------------------------------------------------------===</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">                         Miscellaneous Ungrouped Timers</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">===-------------------------------------------------------------------------===</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br>



</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">   0.8070 ( 87.2%)   0.0550 ( 73.7%)   0.8620 ( 86.2%)   0.8620 ( 86.2%)  Clang front-end timer</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">   0.0747 (  8.1%)   0.0090 ( 12.0%)   0.0837 (  8.4%)   0.0840 (  8.4%)  LLVM IR Generation Time</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">   0.0435 (  4.7%)   0.0106 ( 14.3%)   0.0541 (  5.4%)   0.0541 (  5.4%)  Code Generation Time</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">   0.9251 (100.0%)   0.0746 (100.0%)   0.9998 (100.0%)   1.0001 (100.0%)  Total</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br>



</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">real</span></font><span style="white-space: pre-wrap;"><font face="Monaco" size="3"><span style="font-size: 11px;">       </span></font></span><font face="Monaco" size="3"><span style="font-size: 11px;">0m0.903s</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">user</span></font><span style="white-space: pre-wrap;"><font face="Monaco" size="3"><span style="font-size: 11px;">      </span></font></span><font face="Monaco" size="3"><span style="font-size: 11px;">0m0.827s</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">sys</span></font><span style="white-space: pre-wrap;"><font face="Monaco" size="3"><span style="font-size: 11px;">       </span></font></span><font face="Monaco" size="3"><span style="font-size: 11px;">0m0.074s</span></font></div>



</div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br>



</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">> time clang -cc1 lib/VMCore/Dominators.cpp -Iinclude -Ilib/VMCore -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -ftime-report -fsyntax-only</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><div><font face="Monaco" size="3"><span style="font-size: 11px;">===-------------------------------------------------------------------------===</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">                         Miscellaneous Ungrouped Timers</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">===-------------------------------------------------------------------------===</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">   0.6823 (100.0%)   0.0317 (100.0%)   0.7139 (100.0%)   0.7139 (100.0%)  Clang front-end timer</span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">   0.6823 (100.0%)   0.0317 (100.0%)   0.7139 (100.0%)   0.7139 (100.0%)  Total</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div><div><font face="Monaco" size="3"><span style="font-size: 11px;">real</span></font><span style="white-space: pre-wrap;"><font face="Monaco" size="3"><span style="font-size: 11px;">    </span></font></span><font face="Monaco" size="3"><span style="font-size: 11px;">0m0.736s</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">user</span></font><span style="white-space: pre-wrap;"><font face="Monaco" size="3"><span style="font-size: 11px;">      </span></font></span><font face="Monaco" size="3"><span style="font-size: 11px;">0m0.690s</span></font></div>



<div><font face="Monaco" size="3"><span style="font-size: 11px;">sys</span></font><span style="white-space: pre-wrap;"><font face="Monaco" size="3"><span style="font-size: 11px;">       </span></font></span><font face="Monaco" size="3"><span style="font-size: 11px;">0m0.043s</span></font></div>



</div><div><br></div><div><br></div><div><div><br></div><div>Why the difference, am I doing something wrong ?</div></div><div><br></div><div>-Argiris</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br>
</blockquote></div></div></div><br></div></blockquote></div><br>