Clock() bug on B19
Tein Horng Yuan
tyuan@dont.send.me.junk.mail
Fri Apr 24 08:32:00 GMT 1998
Hi,
I am running gnu-win32 B19-1 on a PII-233 system. Because I need to
measure
the CPU time, I find out 'clock' is not function correct. A test
program is attached.
Please send me email to tyuan@beta.wsl.sinica.edu.tw
By the way, will you have Pentium II optimization version of gcc?
Thanks.
-- Tein
-------------------- The output is ------------------------
G:\>test
0, 1594649.621000, 1649776.485000
1, 4247722.656000, -2653073.035000
2, 4247722.656000, 0.000000
3, 4247722.656000, 0.000000
4, 4247722.656000, 0.000000
5, 4247722.656000, 0.000000
6, 4247722.656000, 0.000000
-------------- source code ------------------
#include <stdio.h>
#include <time.h>
#include <math.h>
typedef double REAL;
REAL second(void)
{ return ((REAL)((REAL)clock()/(REAL)CLOCKS_PER_SEC)); }
main(){
double a,b,c;
long i,j,k,l,m,n,o,p;
c= 0;
b= second();
for(i=0; i<1024 * 1024 * 1024; i ++) {
for(k=0; k<1024 ; k ++)
for(l=0; l<1024 ; l ++)
a = sin(l) + cos(k);
c=b;
b=second();
c= c - b;
printf("%i, %f, %f\n", i, b, c);
}
}
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
More information about the Cygwin
mailing list