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

Ranjan Maitra maitra.mbox.ignored at inbox.com
Sat Feb 27 00:28:17 UTC 2016


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

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/password-manager




More information about the users mailing list