Re: The New Asm's mhz.ex
- Posted by xerox_irs at lvcm.com May 23, 2003
- 371 views
thats that same thing, I just dont know how much of a 64bit integer you can fit into a double(i think 54 bits of presision), thats why I split mine up, into two and did the math seperatly. But this will work just fine. Thanks for making it 64bit, now I don't have a 167mhz processor, I have a 704mhz processor. Just proof the realtime clock is not super accurate, it would be even more fun to run this on a computer with Spread Spectrum Modulation on the cpu, you would get very funny numbers. Daniel Kluss ----- Original Message ----- From: <stabmaster_ at hotmail.com> To: "EUforum" <EUforum at topica.com> Sent: Friday, May 23, 2003 6:29 AM Subject: Re: The New Asm's mhz.ex > > > >the changes to mhz should look something like this > >--code below > > I was thinking more like... > > *************** CODE BEGINS ******************* > > include asm.e > > atom t,dt,cyclemark1,cyclemark2,mhz > integer key > > constant val = allocate(8) > constant RDTSC = get_asm("rdtsc mov [value],eax mov [value+4],edx ret") > resolve_param("value",val) > > > puts(1,"Don\'t run this test unless you\'ve got a Pentium compatible or > greater.\n") > puts(1,"Press [Esc] to abort now, any other key to continue.\n") > key = -1 > while key=-1 do > key = get_key() > end while > if key=27 then > abort(0) > end if > > clear_screen() > dt = 5 > printf(1,"Timing performance, wait %d seconds.\n",dt) > > t = time() > > call(RDTSC) > cyclemark1 = peek4u(val) > cyclemark1 += peek4u(val+4)*power(2,32) > while (t+dt>time()) do > end while > dt = time()-t > > call(RDTSC) > cyclemark2 = peek4u(val) > cyclemark2 += peek4u(val+4)*power(2,32) > > mhz = (cyclemark2-cyclemark1)/(1000000*dt) > if mhz<0 then mhz = -mhz end if > > printf(1,"This processor is running at approx %1.3f MHz\n",mhz) > > *********************** CODE ENDS *************************** > > It's still about 1% off for my processor though, but maybe it fixes the > overflow-problem for faster processors at least. > > > > TOPICA - Start your own email discussion group. FREE! > >