This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
clock and timing.
- To: gcc-help at gcc dot gnu dot org
- Subject: clock and timing.
- From: "Tom Davids" <opentest at angelfire dot com>
- Date: Sun, 21 Oct 2001 21:14:31 -0700
- Organization: Angelfire (http://email.angelfire.mailcity.lycos.com:80)
- Reply-To: opentest at angelfire dot com
I've just coded up this small program
#include <stdio.h>
#include <time.h>
main(){
clock_t start, stop, total;
int count;
start = clock();
printf("%d\n", CLOCKS_PER_SEC);
for(count=0; count < 200000; count++);
stop = clock();
total=stop-start;
printf("total = %lu\n", total);
}
The CLOCKS_PER_SEC is 1000000,
When I run the program I get the either
total = 10000
total = 20000
or
total = 0.
Could someone explain what the numbers range so much when the CLOCKS_PER_SEC is so high.
Any help is highly apprieciated.
Thanks
Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/