Re: timing

Glynn Clements <[email protected]>
Newsgroups org.kernel.vger.linux-gcc
Message-ID <[email protected]>
Mehran Rezaei wrote:

> For the sake of performance analysis of some programs, I am using
> clock() function call. I am running the programs on a linux box (Redhat
> 7.2, and my machine is i686).
> However, I am not getting the correct results as I expected. Perhaps I
> miss something necessary for using timing function calls.

[snip]

> To my understanding both printfs should at least show 10 seconds
> (because of "sleep(10)"). But they do not.

clock() reports the amount of CPU time used by the program. sleep()
will use negligible CPU time (probably too small to measure).

-- 
Glynn Clements <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.