Lines: 26 X-Admin: news AT aol DOT com From: sterten AT aol DOT com (Sterten) Newsgroups: comp.os.msdos.djgpp Date: 05 Sep 2001 04:28:44 GMT Organization: AOL http://www.aol.com Subject: timing-routine Message-ID: <20010905002844.18811.00004524@mb-fa.aol.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com why do I sometimes get non-increasing number on consecutive runs of this routine ? Is there a better way to measure CPU-cycles ? #include "stdio.h" double timing() { long int i=0,j=0; double dd=0; __asm__ __volatile__ (" pushl %%eax pushl %%edx rdtsc movl %%eax,%0 movl %%edx,%1 popl %%edx popl %%eax ":"=g"(i),"=g"(j) ); dd=i*1.0+4294967296.0*j; return(dd);} int main(){ double d1=0; d1=timing(); printf("rdtsc=%lf\n",d1); return(0);}