[cfe-dev] Accuracy of -ftime-report
Amaury Pouly
amaury.pouly at gmail.com
Thu Aug 5 07:03:40 PDT 2010
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) ?
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.
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).
Amaury Pouly
2010/8/5 Argyrios Kyrtzidis <kyrtzidis at apple.com>
> On 5 Aug 2010, at 14:37, Amaury Pouly wrote:
>
> That can be due to lots of things. Just consider this difference:
> - 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
> - 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).
>
> 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.
>
>
> 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.
>
> In general is 'time' utility the more reliable one ?
>
> -Argiris
>
>
> Amaury Pouly
>
>
> 2010/8/5 Argyrios Kyrtzidis <kyrtzidis at apple.com>
>
>> Hi,
>>
>> When I try '-ftime-report' the numbers differ from 'time', either higher
>> or lower, e.g:
>>
>> > 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
>>
>> [LLVM pass timers]
>>
>>
>> ===-------------------------------------------------------------------------===
>> Miscellaneous Ungrouped Timers
>>
>> ===-------------------------------------------------------------------------===
>>
>> ---User Time--- --System Time-- --User+System-- ---Wall Time---
>> --- Name ---
>> 0.8070 ( 87.2%) 0.0550 ( 73.7%) 0.8620 ( 86.2%) 0.8620 ( 86.2%)
>> Clang front-end timer
>> 0.0747 ( 8.1%) 0.0090 ( 12.0%) 0.0837 ( 8.4%) 0.0840 ( 8.4%)
>> LLVM IR Generation Time
>> 0.0435 ( 4.7%) 0.0106 ( 14.3%) 0.0541 ( 5.4%) 0.0541 ( 5.4%)
>> Code Generation Time
>> 0.9251 (100.0%) 0.0746 (100.0%) 0.9998 (100.0%) 1.0001 (100.0%)
>> Total
>>
>>
>> real 0m0.903s
>> user 0m0.827s
>> sys 0m0.074s
>>
>>
>>
>> > 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
>>
>>
>> ===-------------------------------------------------------------------------===
>> Miscellaneous Ungrouped Timers
>>
>> ===-------------------------------------------------------------------------===
>>
>> ---User Time--- --System Time-- --User+System-- ---Wall Time---
>> --- Name ---
>> 0.6823 (100.0%) 0.0317 (100.0%) 0.7139 (100.0%) 0.7139 (100.0%)
>> Clang front-end timer
>> 0.6823 (100.0%) 0.0317 (100.0%) 0.7139 (100.0%) 0.7139 (100.0%)
>> Total
>>
>>
>> real 0m0.736s
>> user 0m0.690s
>> sys 0m0.043s
>>
>>
>>
>> Why the difference, am I doing something wrong ?
>>
>> -Argiris
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100805/f4b920fd/attachment.html>
More information about the cfe-dev
mailing list