OT: recommended way of timing two pieces of code in C

jd1008 jd1008 at gmail.com
Sat Feb 27 00:31:44 UTC 2016



On 02/26/2016 05:28 PM, Ranjan Maitra wrote:
> Thanks again!
>
>>> OK, is there a way to calculate the FLOP instructions in C?
>> What do you mean "calculate the FLOP instructions"? Are you trying to
>> evaluate an algorithm or benchmark an implementation? These are two
>> different things. You can compare algorithms theoretically or by
>> measurement, but only measurement will work for implementations. You
>> can count each floating point instruction generated by the compiler by
>> looking at the binary code, but maybe you want to count every
>> instruction during execution, or see which instructions take longer, or
>> just measure the total execution time of the algorithm on a given set
>> of input.
> Indeed, I wanted to measure the total execution time of the algorithms (i.e. difference in CPU time after and before the function executing the algorithm is called) and independent of extraneous issues such as what other process is running at some time, etc. I wanted to see if, in some case, some of the available theoretical guarantees actually hold or not.
>
> Thanks again!
>
> Best wishes,
> Ranjan
>
Did you see my reply?
It shows you the basics of what you need to use
in order to get exactly what you want.



More information about the users mailing list